public function testSetMainTable() { if (!method_exists('ReflectionMethod', 'setAccessible')) { $this->markTestSkipped('Test requires ReflectionMethod::setAccessible (PHP 5 >= 5.3.2).'); } $setMainTableMethod = new ReflectionMethod($this->_model, '_setMainTable'); $setMainTableMethod->setAccessible(true); $tableName = $this->_model->getTable('core_website'); $idFieldName = 'website_id'; $setMainTableMethod->invoke($this->_model, $tableName); $this->assertEquals($tableName, $this->_model->getMainTable()); $setMainTableMethod->invoke($this->_model, $tableName, $idFieldName); $this->assertEquals($tableName, $this->_model->getMainTable()); $this->assertEquals($idFieldName, $this->_model->getIdFieldName()); }
/** * Return name of table for given $storeId. * * @param integer $storeId * @return string */ public function getMainStoreTable($storeId = Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID) { if (is_string($storeId)) { $storeId = intval($storeId); } if ($this->getUseStoreTables() && $storeId) { $suffix = sprintf('store_%d', $storeId); $table = $this->getTable(array('catalog/category_flat', $suffix)); } else { $table = parent::getMainTable(); } return $table; }