_table['accounts'] = $this->_getTable('My_ZendDbTable_TableAccounts'); $this->_table['bugs'] = $this->_getTable('My_ZendDbTable_TableBugs'); $this->_table['bugs_products'] = $this->_getTable('My_ZendDbTable_TableBugsProducts'); $this->_table['products'] = $this->_getTable('My_ZendDbTable_TableProducts'); } public function tearDown() { if ($this->_runtimeIncludePath) { $this->_restoreIncludePath(); } } protected function _getTable($tableClass, $options = array()) { if (is_array($options) && !isset($options['db'])) { $options['db'] = $this->_db; } if (!class_exists($tableClass)) { $this->_useMyIncludePath(); Zend_Loader::loadClass($tableClass); $this->_restoreIncludePath(); } $table = new $tableClass($options); return $table; } protected function _useMyIncludePath() { $this->_runtimeIncludePath = get_include_path(); set_include_path(dirname(__FILE__) . '/_files/' . PATH_SEPARATOR . $this->_runtimeIncludePath); } protected function _restoreIncludePath() { set_include_path($this->_runtimeIncludePath); $this->_runtimeIncludePath = null; } }