function testSave() { AbstractSession::destroySafely(); call_user_func($this->handler . '::init', $this->wrapper); $_SESSION['foo'] = 'bar'; $id = session_id(); session_write_close(); $sessFetched = $this->wrapper->get($this->prefix . $id); $this->assertNotEmpty($sessFetched, _unit_dump(['id' => $id, 'fetched' => $sessFetched, 'all' => $this->wrapper->getAll(), 'is_available' => $this->wrapper->isAvailable()])); $this->assertTrue(stripos($sessFetched, 'foo') !== false, '"foo" not found in session data'); $this->assertTrue(stripos($sessFetched, 'bar') !== false, '"bar" not found in session data'); }
/** * Read ssession data * * @author Art <*****@*****.**> * @link http://php.net/manual/en/sessionhandlerinterface.read.php * * @param string $sessionID The session id to read data for. * * @return string */ public function read($sessionID) { $data = $this->client->get($this->prefix . $sessionID); return $data ? $data : ''; }
function testSetArray() { $setkey = md5(microtime(true) . mt_rand(PHP_INT_MIN, PHP_INT_MAX)); $this->wrapper[$setkey] = 1; $this->assertNotEmpty($this->wrapper->get($setkey)); }