Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Class: property_list_test  - X-Ref

PHPUnit for property_list class.

test_create_empty_plist()   X-Ref
Test that an empty PList with a root dictionary is created.


test_construct_plist_from_xml()   X-Ref
Test that a Plist is constructed from an XML string.


test_add_element_to_root()   X-Ref
Test that an element can be added to the root dictionary.


test_get_element_value()   X-Ref
Test that an element's value can be retrieved.


test_get_element_value_if_not_exists()   X-Ref
Test that an element's value can be retrieved.


test_get_element_value_if_array()   X-Ref
Test an element's value can be retrieved if it is an array.


test_updating_element_value($xml, $key, $value)   X-Ref
Test that a element's value can be updated that is not an array or dictionary.

param: string $xml XML to create PList.
param: string $key Key of element to try and update.
param: mixed $value Value to try to update with.

test_updating_element_value_with_bad_data(string $xml, string $key, $value, $expected, $exceptionmessage)   X-Ref
Test that a element's value can be updated that is not an array or dictionary.

param: string $xml XML to create PList.
param: string $key Key of element to try and update.
param: mixed $value Bad value to try to update with.
param: mixed $expected Expected value of element after update is called.
param: string $exceptionmessage Message of exception expected to be thrown.

test_updating_element_array_if_dictionary()   X-Ref
Test that a dictionary can have it's value (array) updated.


test_updating_element_array_if_dictionary_with_bad_data()   X-Ref
Test that a dictionary can have it's value (array) updated.


test_delete_element()   X-Ref
Test that an element can be deleted.


test_delete_element_if_not_exists()   X-Ref
Test that an element can be deleted.


test_export_to_json($xml, $expectedjson)   X-Ref
Test that json is exported correctly according to SEB Config Key requirements.

param: string $xml PList XML used to generate CFPropertyList.
param: string $expectedjson Expected JSON output.

test_export_to_json_full_file()   X-Ref
Test that the xml is exported to JSON from a real SEB config file. Expected JSON extracted from SEB logs.


test_set_or_update_value()   X-Ref
Test the set_or_update_value function.


get_plist_xml_header()   X-Ref
Get a valid PList header. Must also use footer.

return: string

get_plist_xml_footer()   X-Ref
Get a valid PList footer. Must also use header.

return: string

good_update_data_provider()   X-Ref
Data provider for good data on update.

return: array Array with test data.

bad_update_data_provider()   X-Ref
Data provider for bad data on update.

return: array Array with test data.

json_data_provider()   X-Ref
Data provider for expected JSON from PList.

Examples extracted from requirements listed in SEB Config Key documents.
https://safeexambrowser.org/developer/seb-config-key.html

1. Date should be in ISO 8601 format.
2. Data should be base 64 encoded.
3. String should be UTF-8 encoded.
4, 5, 6, 7. No requirements for bools, arrays or dicts.
8. Empty dicts should not be included.
9. JSON key ordering should be case insensitive, and use string ordering.
10. URL forward slashes should not be escaped.

return: array