Amp\Test\Artax\ChunkingIteratorTest::testFutureElementResolution PHP Method

testFutureElementResolution() public method

    public function testFutureElementResolution()
    {
        $iter = new \ArrayIterator(['aaa', new \Amp\Success('bb'), 'c']);
        $chunkingIter = new \Amp\Artax\ChunkingIterator($iter);
        $this->assertSame("3\r\naaa\r\n", $chunkingIter->current());
        $chunkingIter->next();
        $promise = $chunkingIter->current();
        $promise->when(function ($error, $result) use($chunkingIter) {
            $this->assertNull($error);
            $this->assertSame("2\r\nbb\r\n", $result);
            $chunkingIter->next();
            $this->assertSame("1\r\nc\r\n", $chunkingIter->current());
        });
    }