GuzzleHttp\Tests\Psr7\FunctionsTest::testReadsLineUntilFalseReturnedFromRead PHP Метод

testReadsLineUntilFalseReturnedFromRead() публичный Метод

    public function testReadsLineUntilFalseReturnedFromRead()
    {
        $s = $this->getMockBuilder('GuzzleHttp\\Psr7\\Stream')->setMethods(['read', 'eof'])->disableOriginalConstructor()->getMock();
        $s->expects($this->exactly(2))->method('read')->will($this->returnCallback(function () {
            static $c = false;
            if ($c) {
                return false;
            }
            $c = true;
            return 'h';
        }));
        $s->expects($this->exactly(2))->method('eof')->will($this->returnValue(false));
        $this->assertEquals('h', Psr7\readline($s));
    }
FunctionsTest