public function PdoSessionHandlerTest::testSessionGC

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php, line 51

Class

PdoSessionHandlerTest

Namespace

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

Code

public function testSessionGC() {
  $storage = new PdoSessionHandler($this->pdo, array(
    'db_table' => 'sessions',
  ), array());
  $storage
    ->write('foo', 'bar');
  $storage
    ->write('baz', 'bar');
  $this
    ->assertEquals(2, count($this->pdo
    ->query('SELECT * FROM sessions')
    ->fetchAll()));
  $storage
    ->gc(-1);
  $this
    ->assertEquals(0, count($this->pdo
    ->query('SELECT * FROM sessions')
    ->fetchAll()));
}