MessagePack\Tests\Unit\BufferUnpackerTest::testTryUnpack PHP Method

testTryUnpack() public method

public testTryUnpack ( )
    public function testTryUnpack()
    {
        $foo = [1, 2];
        $bar = 'bar';
        $packed = "��bar";
        $this->unpacker->append($packed[0]);
        $this->assertSame([], $this->unpacker->tryUnpack());
        $this->unpacker->append($packed[1]);
        $this->assertSame([], $this->unpacker->tryUnpack());
        $this->unpacker->append($packed[2] . $packed[3]);
        $this->assertSame([$foo], $this->unpacker->tryUnpack());
        $this->unpacker->append($packed[4] . $packed[5]);
        $this->assertSame([], $this->unpacker->tryUnpack());
        $this->unpacker->append($packed[6]);
        $this->assertSame([$bar], $this->unpacker->tryUnpack());
    }