public function tearDown() { DBTable::setDefaultAdapter(null); DBTable::setDefaultMetadataCache(); // Restore original autoloaders $loaders = spl_autoload_functions(); foreach ($loaders as $loader) { spl_autoload_unregister($loader); } foreach ($this->loaders as $loader) { spl_autoload_register($loader); } }
public function tearDown() { DBTable::setDefaultAdapter(null); DBTable::setDefaultMetadataCache(); // Restore original autoloaders $loaders = spl_autoload_functions(); foreach ($loaders as $loader) { spl_autoload_unregister($loader); } foreach ($this->loaders as $loader) { spl_autoload_register($loader); } // Reset autoloader instance so it doesn't affect other tests Autoloader::resetInstance(); }
/** * @group ZF-3486 */ public function testTableRelationshipCanFindManyToManyRowsetViaConcreteInstantiation() { Table\Table::setDefaultAdapter($this->_db); $definition = $this->_getTableDefinition(); $bugsTable = new Table\Table('Bugs', $definition); $bugsRowset = $bugsTable->find(1); $bugRow = $bugsRowset->current(); $m2mRowset = $bugRow->findManyToManyRowset('Products', 'BugsProducts'); $this->assertEquals(3, $m2mRowset->count()); }
/** * Defined by Zend_Application_Resource_Resource * * @return \Zend\Db\Adapter\AbstractAdapter|null */ public function init() { if (null !== ($db = $this->getDbAdapter())) { if ($this->isDefaultTableAdapter()) { \Zend\Db\Table\Table::setDefaultAdapter($db); } return $db; } }
/** * @group ZF-5674 */ public function testTableAndIdentityWithVeryLongName() { Table\Table::setDefaultAdapter($this->_db); // create test table using no identifier quoting $this->_util->createTable('thisisaveryverylongtablename', array('thisisalongtablenameidentity' => 'IDENTITY', 'stuff' => 'VARCHAR(32)')); $tableName = $this->_util->getTableName('thisisaveryverylongtablename'); $table = new Table\Table('thisisaveryverylongtablename'); $row = $table->createRow($this->_getRowForTableAndIdentityWithVeryLongName()); $row->save(); $rowset = $table->find(1); $this->assertEquals(1, count($rowset)); $this->_util->dropTable('thisisaveryverylongtablename'); }
/** * Set the default db adapter * * @var \Zend\Db\Adapter\AbstractAdapter $adapter Adapter to set as default */ protected function _setDefault(Adapter\AbstractAdapter $adapter) { \Zend\Db\Table\Table::setDefaultAdapter($adapter); $this->_defaultDb = $adapter; }