You are here

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

File

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

Class

PdoSessionHandlerTest

Namespace

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

Code

public function testSessionDestroy() {
  $pdo = $this
    ->getMemorySqlitePdo();
  $storage = new PdoSessionHandler($pdo);
  $storage
    ->open('', 'sid');
  $storage
    ->read('id');
  $storage
    ->write('id', 'data');
  $storage
    ->close();
  $this
    ->assertEquals(1, $pdo
    ->query('SELECT COUNT(*) FROM sessions')
    ->fetchColumn());
  $storage
    ->open('', 'sid');
  $storage
    ->read('id');
  $storage
    ->destroy('id');
  $storage
    ->close();
  $this
    ->assertEquals(0, $pdo
    ->query('SELECT COUNT(*) FROM sessions')
    ->fetchColumn());
  $storage
    ->open('', 'sid');
  $data = $storage
    ->read('id');
  $storage
    ->close();
  $this
    ->assertSame('', $data, 'Destroyed session returns empty string');
}