From: eileen Date: Wed, 27 Jan 2016 08:23:53 +0000 (+1300) Subject: CRM-17881 add test to CRM_Core_BAO_SchemaHandler::createIndexes fn X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=dd4d51af48dbe381caccfdd039b17c7b33264167;p=civicrm-core.git CRM-17881 add test to CRM_Core_BAO_SchemaHandler::createIndexes fn --- 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); + } + +}