From 70671c35087c4206053308dcc904e1e3bb68203f Mon Sep 17 00:00:00 2001 From: Patrick Figel <pfigel@greenpeace.org> Date: Sat, 9 May 2020 04:20:22 +0200 Subject: [PATCH] CRM/Logging - Remove obsolete cache static clear in test This simplifies CRM_Logging_SchemaTest::testLengthChange() and CRM_Logging_SchemaTest::testEnumChange() by removing a manual reset on a cache static and a second call to CRM_Logging_Schema::fixSchemaDifferences(). This was made obsolete by a40a5a4875bf5caa03eaa8732c958f5c714c7b61, which has added a cache flush to fixSchemaDifferences() via fixSchemaDifferencesForAll(). --- tests/phpunit/CRM/Logging/SchemaTest.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/phpunit/CRM/Logging/SchemaTest.php b/tests/phpunit/CRM/Logging/SchemaTest.php index 41f30ac2ed90..ecfafeb53c21 100644 --- a/tests/phpunit/CRM/Logging/SchemaTest.php +++ b/tests/phpunit/CRM/Logging/SchemaTest.php @@ -279,10 +279,6 @@ public function testLengthChange() { CHANGE COLUMN test_integer test_integer int(6) NULL, CHANGE COLUMN test_decimal test_decimal decimal(22,2) NULL" ); - \Civi::$statics['CRM_Logging_Schema']['columnSpecs'] = []; - $schema->fixSchemaDifferences(); - // need to do it twice so the columnSpecs static is refreshed - \Civi::$statics['CRM_Logging_Schema']['columnSpecs'] = []; $schema->fixSchemaDifferences(); $ci = \Civi::$statics['CRM_Logging_Schema']['columnSpecs']; // length should increase @@ -293,9 +289,6 @@ public function testLengthChange() { CHANGE COLUMN test_integer test_integer int(4) NULL, CHANGE COLUMN test_decimal test_decimal decimal(20,2) NULL" ); - \Civi::$statics['CRM_Logging_Schema']['columnSpecs'] = []; - $schema->fixSchemaDifferences(); - \Civi::$statics['CRM_Logging_Schema']['columnSpecs'] = []; $schema->fixSchemaDifferences(); $ci = \Civi::$statics['CRM_Logging_Schema']['columnSpecs']; // length should not decrease @@ -314,9 +307,6 @@ public function testEnumChange() { CRM_Core_DAO::executeQuery("ALTER TABLE civicrm_test_enum_change CHANGE COLUMN test_enum test_enum enum('A','B','C','D') NULL"); \Civi::$statics['CRM_Logging_Schema']['columnSpecs'] = []; $schema->fixSchemaDifferences(); - // need to do it twice so the columnSpecs static is refreshed - \Civi::$statics['CRM_Logging_Schema']['columnSpecs'] = []; - $schema->fixSchemaDifferences(); $ci = \Civi::$statics['CRM_Logging_Schema']['columnSpecs']; // new enum value should be included $this->assertEquals("'A','B','C','D'", $ci['civicrm_test_enum_change']['test_enum']['ENUM_VALUES']);