From 4aa0df8370ebcea39906981f3c1248855fd26880 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 9 Sep 2018 13:02:01 -0400 Subject: [PATCH] Fix tests to run when database name is not cakephp_test --- .../Case/Model/Behavior/TranslateBehaviorTest.php | 12 ++++++++---- lib/Cake/Test/Case/Model/ModelReadTest.php | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php b/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php index 17e87c84d..8bb584954 100644 --- a/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php +++ b/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php @@ -1455,6 +1455,8 @@ class TranslateBehaviorTest extends CakeTestCase { public function testBeforeFindAllI18nConditions() { $this->skipIf(!$this->db instanceof Mysql, 'This test is only compatible with Mysql.'); + $dbName = $this->db->config['database']; + $this->loadFixtures('TranslateArticle', 'TranslatedArticle', 'User'); $TestModel = new TranslatedArticle(); $TestModel->cacheQueries = false; @@ -1471,7 +1473,7 @@ class TranslateBehaviorTest extends CakeTestCase { 'table' => (object)array( 'tablePrefix' => '', 'table' => 'article_i18n', - 'schemaName' => 'cakephp_test', + 'schemaName' => $dbName, ), 'conditions' => array( 'TranslatedArticle.id' => (object)array( @@ -1489,7 +1491,7 @@ class TranslateBehaviorTest extends CakeTestCase { 'table' => (object)array( 'tablePrefix' => '', 'table' => 'article_i18n', - 'schemaName' => 'cakephp_test', + 'schemaName' => $dbName, ), 'conditions' => array( 'TranslatedArticle.id' => (object)array( @@ -1537,6 +1539,8 @@ class TranslateBehaviorTest extends CakeTestCase { public function testBeforeFindCountI18nConditions() { $this->skipIf(!$this->db instanceof Mysql, 'This test is only compatible with Mysql.'); + $dbName = $this->db->config['database']; + $this->loadFixtures('TranslateArticle', 'TranslatedArticle', 'User'); $TestModel = new TranslatedArticle(); $TestModel->cacheQueries = false; @@ -1553,7 +1557,7 @@ class TranslateBehaviorTest extends CakeTestCase { 'table' => (object)array( 'tablePrefix' => '', 'table' => 'article_i18n', - 'schemaName' => 'cakephp_test', + 'schemaName' => $dbName, ), 'conditions' => array( '`TranslatedArticle`.`id`' => (object)array( @@ -1570,7 +1574,7 @@ class TranslateBehaviorTest extends CakeTestCase { 'table' => (object)array( 'tablePrefix' => '', 'table' => 'article_i18n', - 'schemaName' => 'cakephp_test', + 'schemaName' => $dbName, ), 'conditions' => array( 'TranslatedArticle.id' => (object)array( diff --git a/lib/Cake/Test/Case/Model/ModelReadTest.php b/lib/Cake/Test/Case/Model/ModelReadTest.php index 851290547..feda62de2 100644 --- a/lib/Cake/Test/Case/Model/ModelReadTest.php +++ b/lib/Cake/Test/Case/Model/ModelReadTest.php @@ -6486,6 +6486,8 @@ class ModelReadTest extends BaseModelTest { public function testBuildQueryAllI18nConditions() { $this->skipIf(!$this->db instanceof Mysql, 'This test is only compatible with Mysql.'); + $dbName = $this->db->config['database']; + $this->loadFixtures('TranslateArticle', 'TranslatedArticle', 'User'); $TestModel = new TranslatedArticle(); $TestModel->cacheQueries = false; @@ -6502,7 +6504,7 @@ class ModelReadTest extends BaseModelTest { 'table' => (object)array( 'tablePrefix' => '', 'table' => 'article_i18n', - 'schemaName' => 'cakephp_test', + 'schemaName' => $dbName ), 'conditions' => array( 'TranslatedArticle.id' => (object)array( @@ -6520,7 +6522,7 @@ class ModelReadTest extends BaseModelTest { 'table' => (object)array( 'tablePrefix' => '', 'table' => 'article_i18n', - 'schemaName' => 'cakephp_test', + 'schemaName' => $dbName ), 'conditions' => array( 'TranslatedArticle.id' => (object)array( @@ -6556,6 +6558,8 @@ class ModelReadTest extends BaseModelTest { public function testBuildQueryCountI18nConditions() { $this->skipIf(!$this->db instanceof Mysql, 'This test is only compatible with Mysql.'); + $dbName = $this->db->config['database']; + j $this->loadFixtures('TranslateArticle', 'TranslatedArticle', 'User'); $TestModel = new TranslatedArticle(); $TestModel->cacheQueries = false; @@ -6572,7 +6576,7 @@ class ModelReadTest extends BaseModelTest { 'table' => (object)array( 'tablePrefix' => '', 'table' => 'article_i18n', - 'schemaName' => 'cakephp_test', + 'schemaName' => $dbName ), 'conditions' => array( '`TranslatedArticle`.`id`' => (object)array( @@ -6589,7 +6593,7 @@ class ModelReadTest extends BaseModelTest { 'table' => (object)array( 'tablePrefix' => '', 'table' => 'article_i18n', - 'schemaName' => 'cakephp_test', + 'schemaName' => $dbName ), 'conditions' => array( 'TranslatedArticle.id' => (object)array(