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.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]

Persistent class tests.

Copyright: 2015 Frédéric Massart - FMCorz.net
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 832 lines (30 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes


Class: persistent_test  - X-Ref

Persistent testcase.

setUp()   X-Ref
No description

make_persistent_table()   X-Ref
Make the table for the persistent.


make_second_persistent_table()   X-Ref
Make the second table for the persistent.


test_properties_definition()   X-Ref
No description

test_constructor()   X-Ref
Test creating persistent instance by specifying record ID in constructor


test_constructor_invalid()   X-Ref
Test creating persistent instance by specifying non-existing record ID in constructor throws appropriate exception


test_to_record()   X-Ref
No description

test_from_record()   X-Ref
No description

test_from_record_invalid_param()   X-Ref
No description

test_validate()   X-Ref
No description

test_validation_required()   X-Ref
No description

test_validation_custom()   X-Ref
No description

test_validation_custom_message()   X-Ref
No description

test_validation_choices()   X-Ref
No description

test_validation_type()   X-Ref
No description

test_validation_null()   X-Ref
No description

test_create()   X-Ref
No description

test_update()   X-Ref
No description

test_set_many_update()   X-Ref
Test set_many prior to updating the persistent


test_save()   X-Ref
No description

test_set_many_save()   X-Ref
Test set_many prior to saving the persistent


test_set_many_empty()   X-Ref
Test set_many with empty array should not modify the persistent


test_set_invalid_property()   X-Ref
Test set with invalid property


test_set_many_invalid_property()   X-Ref
Test set_many with invalid property


test_read()   X-Ref
No description

test_delete()   X-Ref
No description

test_has_property()   X-Ref
No description

test_custom_setter_getter()   X-Ref
No description

test_get_record()   X-Ref
Test get_record method for creating persistent instance


test_get_record_ignore_missing()   X-Ref
Test get_record method for creating persistent instance, ignoring a non-existing record


test_get_record_must_exist()   X-Ref
Test get_record method for creating persistent instance, throws appropriate exception for non-existing record


test_record_exists()   X-Ref
No description

test_get_sql_fields()   X-Ref
No description

test_get_sql_fields_too_long()   X-Ref
No description

test_get()   X-Ref
No description

Class: core_testable_persistent  - X-Ref

Example persistent class.

define_properties()   X-Ref
No description

before_validate()   X-Ref
No description

before_create()   X-Ref
No description

before_update()   X-Ref
No description

before_delete()   X-Ref
No description

after_create()   X-Ref
No description

after_update($result)   X-Ref
No description

after_delete($result)   X-Ref
No description

get_path()   X-Ref
No description

set_path($value)   X-Ref
No description

validate_sortorder($value)   X-Ref
No description

Class: core_testable_second_persistent  - X-Ref

Example persistent class to test types.

define_properties()   X-Ref
Return the list of properties.

return: array