From dd4d51af48dbe381caccfdd039b17c7b33264167 Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 27 Jan 2016 21:23:53 +1300 Subject: [PATCH] CRM-17881 add test to CRM_Core_BAO_SchemaHandler::createIndexes fn --- .../CRM/Core/BAO/SchemaHandlerTest.php | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 tests/phpunit/CRM/Core/BAO/SchemaHandlerTest.php diff --git a/tests/phpunit/CRM/Core/BAO/SchemaHandlerTest.php b/tests/phpunit/CRM/Core/BAO/SchemaHandlerTest.php new file mode 100644 index 0000000000..3e5403582d --- /dev/null +++ b/tests/phpunit/CRM/Core/BAO/SchemaHandlerTest.php @@ -0,0 +1,57 @@ + array('weight')); + CRM_Core_BAO_SchemaHandler::createIndexes($tables); + CRM_Core_BAO_SchemaHandler::createIndexes($tables); + $dao = CRM_Core_DAO::executeQuery("SHOW INDEX FROM civicrm_uf_join"); + $count = 0; + + while ($dao->fetch()) { + if ($dao->Column_name == 'weight') { + $count++; + CRM_Core_DAO::executeQuery("ALTER TABLE civicrm_uf_join DROP INDEX " . $dao->Key_name); + } + } + $this->assertEquals(1, $count); + } + +} -- 2.25.1