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' 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"); } /** * optionGroupTests * * @return array */ public function optionGroupTests() { $tests = []; $tests[] = ['event_type', 'Integer']; $tests[] = ['addressee', 'null']; $tests[] = ['activity_status', 'Integer']; return $tests; } /** * Test Returning DataType of Option Group * * * @dataProvider optionGroupTests */ public function testsOptionGroupDataType($optionGroup, $expectedDataType) { $dataType = CRM_Admin_Form_Options::getOptionGroupDataType($optionGroup); if ($expectedDataType == 'null') { $this->assertNull($dataType); } else { $this->assertEquals($dataType, $expectedDataType); } } public function emailAddressTests() { $tests[] = ['"Name"', '"Name" ']; $tests[] = ['"Name" ', '"Name" ']; $tests[] = ['"Name" ', '"Name" ']; return $tests; } /** * @dataProvider emailAddressTests */ public function testSanitizeFromEmailAddress($dirty, $clean) { $form = new CRM_Admin_Form_Options(); $actual = $form->sanitizeFromEmailAddress($dirty); $this->assertEquals($actual, $clean); } }