MDL-47726 availability: fix tests when there is a text custom field
authorTim Hunt <T.J.Hunt@open.ac.uk>
Mon, 20 Oct 2014 14:53:19 +0000 (15:53 +0100)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Mon, 20 Oct 2014 15:15:34 +0000 (16:15 +0100)
This unit tests assumed that on a fresh install, there were no custom
user-profile fields. Given some third-party plugins, that assumption is
false.

availability/condition/profile/tests/condition_test.php

index df9e085..e2250e2 100644 (file)
@@ -342,7 +342,8 @@ class availability_profile_condition_testcase extends advanced_testcase {
         // The list of fields should include the text field added in setUp(),
         // but should not include the textarea field added just now.
         $fields = condition::get_custom_profile_fields();
         // The list of fields should include the text field added in setUp(),
         // but should not include the textarea field added just now.
         $fields = condition::get_custom_profile_fields();
-        $this->assertEquals(array('frogtype'), array_keys($fields));
+        $this->assertArrayHasKey('frogtype', $fields);
+        $this->assertArrayNotHasKey('longtext', $fields);
     }
 
     /**
     }
 
     /**