read() 공개 메소드

(Fix for PHP 7 to make sure it really returns string type as docblock promises, because otherwise session crashes.)
public read ( string $sessId ) : string
$sessId string
리턴 string
예제 #1
0
 public function testGc()
 {
     $this->_model->write('test', 'test');
     $this->assertEquals('test', $this->_model->read('test'));
     $this->_model->gc(-1);
     $this->assertEmpty($this->_model->read('test'));
 }
예제 #2
0
 public function testWriteReadDestroy()
 {
     $sessionId = 'my_test_id';
     $data = serialize(array('test key' => 'test value'));
     $this->_model->write($sessionId, $data);
     $this->assertEquals($data, $this->_model->read($sessionId));
     $data = serialize(array('new key' => 'new value'));
     $this->_model->write($sessionId, $data);
     $this->assertEquals($data, $this->_model->read($sessionId));
     $this->_model->destroy($sessionId);
     $this->assertEmpty($this->_model->read($sessionId));
 }
예제 #3
0
 /**
  * Assert that session data reads from DB correctly regardless of encoding
  *
  * @param string $sessionData
  *
  * @dataProvider readEncodedDataProvider
  */
 public function testReadEncoded($sessionData)
 {
     $sessionRecord = array(self::COLUMN_SESSION_ID => self::SESSION_ID, self::COLUMN_SESSION_DATA => $sessionData);
     $this->_connection->insertOnDuplicate($this->_sessionTable, $sessionRecord, array(self::COLUMN_SESSION_DATA));
     $sessionData = $this->_model->read(self::SESSION_ID);
     $this->assertEquals($this->_sourceData[self::SESSION_NEW], unserialize($sessionData));
 }
예제 #4
0
 /**
  * @param bool $isDataEncoded
  *
  * @dataProvider readDataProvider
  */
 public function testRead($isDataEncoded)
 {
     $this->_prepareMockForRead($isDataEncoded);
     $result = $this->_model->read(self::SESSION_ID);
     $this->assertEquals(self::SESSION_DATA, $result);
 }