You are here

public function PdoSessionHandlerTest::testWithLazySavePathConnection 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::testWithLazySavePathConnection()

File

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

Class

PdoSessionHandlerTest

Namespace

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

Code

public function testWithLazySavePathConnection() {
  $dsn = $this
    ->getPersistentSqliteDsn();

  // Open is called with what ini_set('session.save_path', $dsn) would mean
  $storage = new PdoSessionHandler(null);
  $storage
    ->open($dsn, 'sid');
  $storage
    ->createTable();
  $data = $storage
    ->read('id');
  $storage
    ->write('id', 'data');
  $storage
    ->close();
  $this
    ->assertSame('', $data, 'New session returns empty string data');
  $storage
    ->open($dsn, 'sid');
  $data = $storage
    ->read('id');
  $storage
    ->close();
  $this
    ->assertSame('data', $data, 'Written value can be read back correctly');
}