Differences Between: [Versions 310 and 311] [Versions 39 and 311]
(no description)
File Size: | 536 lines (23 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
condition_test:: (11 methods):
setUp()
test_in_tree()
test_constructor()
test_save()
test_is_available()
test_custom_textarea_field()
set_field()
assert_is_available_result()
test_filter_users()
test_get_user_list_sql()
assert_user_list_sql_results()
Class: condition_test - X-Ref
Unit tests for the user profile condition.setUp() X-Ref |
No description |
test_in_tree() X-Ref |
Tests constructing and using date condition as part of tree. |
test_constructor() X-Ref |
Tests the constructor including error conditions. Also tests the string conversion feature (intended for debugging only). |
test_save() X-Ref |
Tests the save() function. |
test_is_available() X-Ref |
Tests the is_available function. There is no separate test for get_full_information because that function is called from is_available and we test its values here. |
test_custom_textarea_field() X-Ref |
Tests what happens with custom fields that are text areas. These should not be offered in the menu because their data is not included in user object |
set_field($userid, $value, $fieldid = 0) X-Ref |
Sets the custom profile field used for testing. param: int $userid User id param: string|null $value Field value or null to clear param: int $fieldid Field id or 0 to use default one |
assert_is_available_result($yes, $failpattern, condition $cond,\core_availability\info $info, $userid) X-Ref |
Checks the result of is_available. This function is to save duplicated code; it does two checks (the normal is_available with $not set to true and set to false). Whichever result is expected to be true, it checks $information ends up as empty string for that one, and as a regex match for another one. param: bool $yes If the positive test is expected to return true param: string $failpattern Regex pattern to match text when it returns false param: condition $cond Condition param: \core_availability\info $info Information about current context param: int $userid User id |
test_filter_users() X-Ref |
Tests the filter_users (bulk checking) function. |
test_get_user_list_sql() X-Ref |
Tests getting user list SQL. This is a different test from the above because there is some additional code in this function so more variants need testing. |
assert_user_list_sql_results(array $expected, $not = false) X-Ref |
Convenience function. Gets the user list SQL and runs it, then checks results. param: array $expected Array of expected user ids param: bool $not True if using NOT condition |