From: Edsel Date: Sun, 19 Jun 2016 06:52:14 +0000 (+0530) Subject: CRM-16189 Added unit test for option group extra param X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=58e06f881dcde2634f1858e15785c7e12330d907;p=civicrm-core.git CRM-16189 Added unit test for option group extra param ---------------------------------------- * CRM-16189: Improve support for Accrual Method bookkeeping https://issues.civicrm.org/jira/browse/CRM-16189 --- diff --git a/tests/phpunit/CRM/Core/OptionGroupTest.php b/tests/phpunit/CRM/Core/OptionGroupTest.php new file mode 100644 index 0000000000..a2390261f4 --- /dev/null +++ b/tests/phpunit/CRM/Core/OptionGroupTest.php @@ -0,0 +1,67 @@ +assertTrue(($options1 == $options2), "The arrays retrieved should be the same"); + // Verify sequence is different. + $this->assertFalse(($options1 === $options2), "The arrays retrieved should be the same, but in a different order"); + // Verify values. + $sql = "SELECT v.value, v.label + FROM civicrm_option_value v + INNER JOIN civicrm_option_group g ON g.id = v.option_group_id + AND g.name = 'activity_type' + WHERE g.is_active = 1 AND v.is_active = 1 + ORDER BY v.name"; + $dao = CRM_Core_DAO::executeQuery($sql); + while ($dao->fetch()) { + $values[$dao->value] = $dao->label; + } + $this->assertTrue(($values === $options2), "The arrays retrieved should be the same and in the same order"); + } + + +}