public function testPassingStorageViaParamOverridesStorageInConfig()
 {
     $storage = new Session\Storage\ArrayStorage();
     $manager = new TestAsset\TestManager(array('class' => 'Zend\\Session\\Configuration\\StandardConfiguration', 'storage' => 'Zend\\Session\\Storage\\SessionStorage'), $storage);
     $this->assertSame($storage, $manager->getStorage());
 }
Exemple #2
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');
     }
 }
 public function testPassingSaveHandlerViaParamOverridesSaveHandlerInConfig()
 {
     $saveHandler = new TestAsset\TestSaveHandler();
     $manager = new TestAsset\TestManager(array('class' => 'Zend\\Session\\Configuration\\StandardConfiguration', 'saveHandler' => 'ZendTest\\Session\\TestAsset\\TestSaveHandler'), null, $saveHandler);
     $this->assertSame($saveHandler, $manager->getSaveHandler());
 }