You are here

public function PdoSessionHandlerTest::testReadConvertsStreamToString in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php \Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest::testReadConvertsStreamToString()

File

vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php, line 138

Class

PdoSessionHandlerTest

Namespace

Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler

Code

public function testReadConvertsStreamToString() {
  $pdo = new MockPdo('pgsql');
  $pdo->prepareResult = $this
    ->getMock('PDOStatement');
  $content = 'foobar';
  $stream = $this
    ->createStream($content);
  $pdo->prepareResult
    ->expects($this
    ->once())
    ->method('fetchAll')
    ->will($this
    ->returnValue(array(
    array(
      $stream,
      42,
      time(),
    ),
  )));
  $storage = new PdoSessionHandler($pdo);
  $result = $storage
    ->read('foo');
  $this
    ->assertSame($content, $result);
}