Exemplo n.º 1
1
 /**
  * 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 = [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]));
 }
Exemplo n.º 2
0
 /**
  * @param bool $sessionExists
  *
  * @dataProvider writeDataProvider
  */
 public function testWrite($sessionExists)
 {
     $this->_prepareMockForWrite($sessionExists);
     $this->assertTrue($this->_model->write(self::SESSION_ID, self::SESSION_DATA));
 }