You are here

public function FunctionsTest::testReadsLineUntilFalseReturnedFromRead in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/psr7/tests/FunctionsTest.php \GuzzleHttp\Tests\Psr7\FunctionsTest::testReadsLineUntilFalseReturnedFromRead()

File

vendor/guzzlehttp/psr7/tests/FunctionsTest.php, line 86

Class

FunctionsTest

Namespace

GuzzleHttp\Tests\Psr7

Code

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));
}