Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

(no description)

File Size: 463 lines (20 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes


Class: base_test  - X-Ref

Course related unit tests

setupBeforeClass()   X-Ref
Setup to ensure that fixtures are loaded.


test_courseformat_saveandload()   X-Ref
Tests the save and load functionality.

author: Jason den Dulk

test_available_hook()   X-Ref
No description

test_supports_news()   X-Ref
Test for supports_news() with a course format plugin that doesn't define 'news_items' in default blocks.


test_supports_news_legacy()   X-Ref
Test for supports_news() for old course format plugins that defines 'news_items' in default blocks.


test_get_view_url()   X-Ref
Test for get_view_url() to ensure that the url is only given for the correct cases


test_get_output_classname($find, $result, $exception)   X-Ref
Test for get_output_classname method.

param: string $find the class to find
param: string $result the expected result classname
param: bool $exception if the method will raise an exception

get_output_classname_provider()   X-Ref
Data provider for test_get_output_classname.

return: array the testing scenarios

test_get_sections_preferences()   X-Ref
Test for the default delete format data behaviour.


test_set_sections_preference()   X-Ref
Test for the default delete format data behaviour.


test_delete_format_data(bool $usehook)   X-Ref
Test for the default delete format data behaviour.

param: bool $usehook if it should use course_delete to trigger $format->delete_format_data as a hook

delete_format_data_provider()   X-Ref
Data provider for test_delete_format_data.

return: array the testing scenarios

Class: format_testformat  - X-Ref

Class format_testformat.

A test class that simulates a course format that doesn't define 'news_items' in default blocks.

get_default_blocks()   X-Ref
Returns the list of blocks to be automatically added for the newly created course.

return: array

Class: format_testlegacy  - X-Ref

Class format_testlegacy.

A test class that simulates old course formats that define 'news_items' in default blocks.

get_default_blocks()   X-Ref
Returns the list of blocks to be automatically added for the newly created course.

return: array