|
|
@@ -515,18 +515,105 @@ class Zend_Session_SaveHandler_DbTableTest extends PHPUnit_Framework_TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * @group 9294
|
|
|
+ */
|
|
|
+ public function testDestroyWithAutoQuoteIdentifiersEnabledAndDisabled()
|
|
|
+ {
|
|
|
+ $id = uniqid();
|
|
|
+ $config = $this->_saveHandlerTableConfig;
|
|
|
+ $configDb = array(
|
|
|
+ 'options' => array(
|
|
|
+ 'autoQuoteIdentifiers' => false,
|
|
|
+ ),
|
|
|
+ 'profiler' => true
|
|
|
+ );
|
|
|
+ $this->_setupDb($config['primary'], $configDb);
|
|
|
+ $config['db'] = $this->_db;
|
|
|
+
|
|
|
+ $saveHandler = new Zend_Session_SaveHandler_DbTable($config);
|
|
|
+ $saveHandler->destroy($id);
|
|
|
+ $lastQuery = $this->_db
|
|
|
+ ->getProfiler()
|
|
|
+ ->getLastQueryProfile()
|
|
|
+ ->getQuery();
|
|
|
+ $partQueryExpected = "WHERE (id = '$id') AND (save_path = '') AND (name = '')";
|
|
|
+ $this->assertContains($partQueryExpected, $lastQuery);
|
|
|
+
|
|
|
+ $configDb = array(
|
|
|
+ 'options' => array(
|
|
|
+ 'autoQuoteIdentifiers' => true,
|
|
|
+ ),
|
|
|
+ 'profiler' => true
|
|
|
+ );
|
|
|
+ $this->_setupDb($config['primary'], $configDb);
|
|
|
+ $config['db'] = $this->_db;
|
|
|
+
|
|
|
+ $saveHandler = new Zend_Session_SaveHandler_DbTable($config);
|
|
|
+ $saveHandler->destroy($id);
|
|
|
+ $lastQuery = $this->_db
|
|
|
+ ->getProfiler()
|
|
|
+ ->getLastQueryProfile()
|
|
|
+ ->getQuery();
|
|
|
+ $partQueryExpected = "WHERE (\"id\" = '$id') AND (\"save_path\" = '') AND (\"name\" = '')";
|
|
|
+ $this->assertContains($partQueryExpected, $lastQuery);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @group 9294
|
|
|
+ */
|
|
|
+ public function testGcWithAutoQuoteIdentifiersEnabledAndDisabled()
|
|
|
+ {
|
|
|
+ $config = $this->_saveHandlerTableConfig;
|
|
|
+ $configDb = array(
|
|
|
+ 'options' => array(
|
|
|
+ 'autoQuoteIdentifiers' => false,
|
|
|
+ ),
|
|
|
+ 'profiler' => true
|
|
|
+ );
|
|
|
+ $this->_setupDb($config['primary'], $configDb);
|
|
|
+ $config['db'] = $this->_db;
|
|
|
+
|
|
|
+ $saveHandler = new Zend_Session_SaveHandler_DbTable($config);
|
|
|
+ $saveHandler->gc(false);
|
|
|
+ $lastQuery = $this->_db
|
|
|
+ ->getProfiler()
|
|
|
+ ->getLastQueryProfile()
|
|
|
+ ->getQuery();
|
|
|
+ $partQueryExpected = "WHERE (modified + lifetime < ";
|
|
|
+ $this->assertContains($partQueryExpected, $lastQuery);
|
|
|
+
|
|
|
+ $configDb = array(
|
|
|
+ 'options' => array(
|
|
|
+ 'autoQuoteIdentifiers' => true,
|
|
|
+ ),
|
|
|
+ 'profiler' => true
|
|
|
+ );
|
|
|
+ $this->_setupDb($config['primary'], $configDb);
|
|
|
+ $config['db'] = $this->_db;
|
|
|
+
|
|
|
+ $saveHandler = new Zend_Session_SaveHandler_DbTable($config);
|
|
|
+ $saveHandler->gc(false);
|
|
|
+ $lastQuery = $this->_db
|
|
|
+ ->getProfiler()
|
|
|
+ ->getLastQueryProfile()
|
|
|
+ ->getQuery();
|
|
|
+ $partQueryExpected = "WHERE (\"modified\" + \"lifetime\" < ";
|
|
|
+ $this->assertContains($partQueryExpected, $lastQuery);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Sets up the database connection and creates the table for session data
|
|
|
*
|
|
|
* @param array $primary
|
|
|
* @return void
|
|
|
*/
|
|
|
- protected function _setupDb(array $primary)
|
|
|
+ protected function _setupDb(array $primary, array $config = array())
|
|
|
{
|
|
|
if (!extension_loaded('pdo_sqlite')) {
|
|
|
$this->markTestSkipped('The pdo_sqlite extension must be available and enabled for this test');
|
|
|
}
|
|
|
|
|
|
- $this->_db = Zend_Db::factory('Pdo_Sqlite', array('dbname' => ':memory:'));
|
|
|
+ $this->_db = Zend_Db::factory('Pdo_Sqlite', array('dbname' => ':memory:') + $config);
|
|
|
Zend_Db_Table_Abstract::setDefaultAdapter($this->_db);
|
|
|
$query = array();
|
|
|
$query[] = 'CREATE TABLE `Sessions` ( ';
|