Adding tests for db source prefix switching. Refs #5266

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7479 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mark_story 2008-08-20 02:37:23 +00:00
parent a59f4d0170
commit b4c14ab89c

View file

@ -5016,6 +5016,28 @@ class ModelTest extends CakeTestCase {
$TestModel->setDataSource('database1');
$this->assertEqual($this->db->fullTableName($TestModel, false), 'custom_apples');
$this->assertEqual($db1->fullTableName($TestModel, false), 'custom_apples');
$TestModel = new Apple();
$TestModel->setDataSource('database1');
$this->assertEqual($this->db->fullTableName($TestModel, false), 'aaa_apples');
$TestModel->tablePrefix = '';
$TestModel->setDataSource('database2');
$this->assertEqual($db2->fullTableName($TestModel, false), 'apples');
$this->assertEqual($db1->fullTableName($TestModel, false), 'apples');
$TestModel->tablePrefix = null;
$TestModel->setDataSource('database1');
$this->assertEqual($db2->fullTableName($TestModel, false), 'aaa_apples');
$this->assertEqual($db1->fullTableName($TestModel, false), 'aaa_apples');
$TestModel->tablePrefix = false;
$TestModel->setDataSource('database2');
$this->assertEqual($db2->fullTableName($TestModel, false), 'apples');
$this->assertEqual($db1->fullTableName($TestModel, false), 'apples');
}
function getTests() {
return array('start', 'startCase', 'testTablePrefixSwitching', 'endCase', 'end');
}
/**
* testDynamicBehaviorAttachment method