$t->is($retrieved_data, $newSessionData, 'sessionRead() reads session data'); // sessionWrite() $otherSessionData = 'foo:foo:foo'; try { $write = $storage->sessionWrite($session_id, $otherSessionData); $t->pass('sessionWrite() does not throw an exception'); } catch (Exception $e) { $t->fail('sessionWrite() does not throw an exception'); } $t->ok($write, 'sessionWrite() returns true'); $t->is($storage->sessionRead($session_id), $otherSessionData, 'sessionWrite() wrote session data'); // sessionGC() try { $storage->sessionGC(0); $t->pass('sessionGC() does not throw an exception'); } catch (Exception $e) { $t->fail('sessionGC() does not throw an exception'); } // destroy the session try { $storage->sessionDestroy($session_id); $t->pass('sessionDestroy() does not throw an exception'); } catch (Exception $e) { $t->fail('sessionClose() does not throw an exception'); } $result = $connection->query(sprintf('SELECT sess_id, sess_data FROM session WHERE sess_id = "%s"', $session_id)); $data = $result->fetchAll(); $t->is(count($data), 0, 'session is removed from the database'); // shutdown the storage $storage->shutdown();