Ejemplo n.º 1
0
 public function testSessionSaving()
 {
     $this->_dropTable();
     $config = $this->_saveHandlerTableConfig;
     unset($config[DbTable::PRIMARY_ASSIGNMENT]);
     $config['primary'] = array($config['primary'][0]);
     $this->_setupDb($config['primary']);
     $this->_usedSaveHandlers[] = $saveHandler = new DbTable($config);
     $manager = new TestManager(null, null, $saveHandler);
     $manager->start();
     /**
      * @see Zend_Session_Namespace
      */
     $session = new \Zend\Session\Container('SaveHandler', $manager);
     $session->testArray = $this->_saveHandlerTableConfig;
     $tmp = array('SaveHandler' => serialize(array('testArray' => $this->_saveHandlerTableConfig)));
     $testAgainst = '';
     foreach ($tmp as $key => $val) {
         $testAgainst .= $key . "|" . $val;
     }
     session_write_close();
     foreach ($this->_db->query('SELECT * FROM Sessions')->fetchAll() as $row) {
         $this->assertSame($row[$config[DbTable::DATA_COLUMN]], $testAgainst, 'Data was not saved properly');
     }
 }