mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
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:
parent
a59f4d0170
commit
b4c14ab89c
1 changed files with 22 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue