write() 공개 메소드

Update session
public write ( string $sessId, string $sessData ) : boolean
$sessId string
$sessData string
리턴 boolean
예제 #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 writes to DB in base64 encoding
  */
 public function testWriteEncoded()
 {
     $data = serialize($this->_sessionData[self::SESSION_NEW]);
     $this->_model->write(self::SESSION_ID, $data);
     $select = $this->_connection->select()->from($this->_sessionTable)->where(self::COLUMN_SESSION_ID . ' = :' . self::COLUMN_SESSION_ID);
     $bind = array(self::COLUMN_SESSION_ID => self::SESSION_ID);
     $session = $this->_connection->fetchRow($select, $bind);
     $this->assertEquals(self::SESSION_ID, $session[self::COLUMN_SESSION_ID]);
     $this->assertTrue(ctype_digit((string) $session[self::COLUMN_SESSION_EXPIRES]), 'Value of session expire field must have integer type');
     $this->assertEquals($data, base64_decode($session[self::COLUMN_SESSION_DATA]));
 }
예제 #4
0
 /**
  * @param bool $sessionExists
  *
  * @dataProvider writeDataProvider
  */
 public function testWrite($sessionExists)
 {
     $this->_prepareMockForWrite($sessionExists);
     $this->assertTrue($this->_model->write(self::SESSION_ID, self::SESSION_DATA));
 }