From f776811c57f2c3132b679598e1ee2d201b1b2753 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 17 Aug 2022 00:18:50 -0700 Subject: [PATCH] LoggingTest - Update multilingual helper calls --- tests/phpunit/CRM/Logging/LoggingTest.php | 25 ++++++----------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/tests/phpunit/CRM/Logging/LoggingTest.php b/tests/phpunit/CRM/Logging/LoggingTest.php index 58ba85a002..9523645f11 100644 --- a/tests/phpunit/CRM/Logging/LoggingTest.php +++ b/tests/phpunit/CRM/Logging/LoggingTest.php @@ -3,22 +3,17 @@ /** * Class CRM_Core_DAOTest * @group headless + * @group locale */ class CRM_Logging_LoggingTest extends CiviUnitTestCase { use CRMTraits_Custom_CustomDataTrait; - /** - * Has the db been set to multilingual. - * - * @var bool - */ - protected $isDBMultilingual = FALSE; - public function tearDown(): void { Civi::settings()->set('logging', FALSE); - if ($this->isDBMultilingual) { - CRM_Core_I18n_Schema::makeSinglelingual('en_US'); + global $dbLocale; + if ($dbLocale) { + $this->disableMultilingual(); } $logging = new CRM_Logging_Schema(); $logging->dropAllLogTables(); @@ -64,7 +59,7 @@ class CRM_Logging_LoggingTest extends CiviUnitTestCase { * Test creating logging schema when database is in multilingual mode. */ public function testMultilingualLogging(): void { - $this->makeMultilingual(); + $this->enableMultilingual(); Civi::settings()->set('logging', TRUE); $value = CRM_Core_DAO::singleValueQuery('SELECT id FROM log_civicrm_contact LIMIT 1', [], FALSE, FALSE); $this->assertNotNull($value, 'Logging not enabled successfully'); @@ -75,7 +70,7 @@ class CRM_Logging_LoggingTest extends CiviUnitTestCase { * Also test altering a multilingual table. */ public function testMultilingualAlterSchemaLogging(): void { - $this->makeMultilingual(); + $this->enableMultilingual(); Civi::settings()->set('logging', TRUE); $logging = new CRM_Logging_Schema(); $value = CRM_Core_DAO::singleValueQuery('SELECT id FROM log_civicrm_contact LIMIT 1', [], FALSE, FALSE); @@ -113,12 +108,4 @@ class CRM_Logging_LoggingTest extends CiviUnitTestCase { ); } - /** - * Convert the database to multilingual mode. - */ - protected function makeMultilingual(): void { - CRM_Core_I18n_Schema::makeMultilingual('en_US'); - $this->isDBMultilingual = TRUE; - } - } -- 2.25.1