getBuffer()); $this->expectException(PacketDecodeException::class); $readCount = 0; foreach($read->getPackets(PacketPool::getInstance(), $limit) as $packet){ $readCount++; } } public function testDecodeAtLimit() : void{ $limit = 10; $write = PacketBatch::fromPackets(...array_fill(0, $limit, new TestPacket())); $read = new PacketBatch($write->getBuffer()); $readCount = 0; foreach($read->getPackets(PacketPool::getInstance(), $limit) as $packet){ $readCount++; } self::assertSame($limit, $readCount); } }