Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

Tests for the moodle_page class.

Copyright: 2009 Tim Hunt
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 793 lines (31 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

moodle_page_test:: (61 methods):
  setUp()
  test_course_returns_site_before_set()
  test_setting_course_works()
  test_global_course_and_page_course_are_same_with_global_page()
  test_global_course_not_changed_with_non_global_page()
  test_cannot_set_course_once_theme_set()
  test_cannot_set_category_once_theme_set()
  test_cannot_set_category_once_course_set()
  test_categories_array_empty_for_front_page()
  test_set_state_normal_path()
  test_set_state_cannot_skip_one()
  test_header_printed_false_initially()
  test_header_printed_becomes_true()
  test_set_context()
  test_pagetype_defaults_to_script()
  test_set_pagetype()
  test_initialise_default_pagetype()
  test_initialise_default_pagetype_fp()
  test_get_body_classes_empty()
  test_get_body_classes_single()
  test_get_body_classes()
  test_url_to_class_name()
  test_set_docs_path()
  test_docs_path_defaults_from_pagetype()
  test_set_url_root()
  test_set_url_one_param()
  test_set_url_two_params()
  test_set_url_using_moodle_url()
  test_set_url_sets_page_type()
  test_set_url_does_not_change_explicit_page_type()
  test_set_subpage()
  test_set_heading()
  test_set_title()
  test_default_pagelayout()
  test_set_pagelayout()
  test_setting_course_sets_context()
  test_set_category_top_level()
  test_set_nested_categories()
  test_cm_null_initially()
  test_set_cm()
  test_cannot_set_activity_record_before_cm()
  test_setting_cm_sets_context()
  test_activity_record_loaded_if_not_set()
  test_set_activity_record()
  test_cannot_set_inconsistent_activity_record_course()
  test_cannot_set_inconsistent_activity_record_instance()
  test_setting_cm_sets_course()
  test_set_cm_with_course_and_activity_no_db()
  test_cannot_set_cm_with_inconsistent_course()
  test_get_activity_name()
  test_user_is_editing_on()
  test_user_is_editing_off()
  test_default_editing_capabilities()
  test_other_block_editing_cap()
  test_other_editing_cap()
  test_other_editing_caps()
  test_get_renderer()
  test_get_renderer_maintenance()
  test_render_to_cli()
  test_cohort_get_user_theme()
  get_user_theme_provider()

testable_moodle_page:: (3 methods):
  initialise_default_pagetype()
  url_to_class_name()
  all_editing_caps()


Class: moodle_page_test  - X-Ref

Tests for the moodle_page class.

setUp()   X-Ref


test_course_returns_site_before_set()   X-Ref
No description

test_setting_course_works()   X-Ref
No description

test_global_course_and_page_course_are_same_with_global_page()   X-Ref
No description

test_global_course_not_changed_with_non_global_page()   X-Ref
No description

test_cannot_set_course_once_theme_set()   X-Ref
No description

test_cannot_set_category_once_theme_set()   X-Ref
No description

test_cannot_set_category_once_course_set()   X-Ref
No description

test_categories_array_empty_for_front_page()   X-Ref
No description

test_set_state_normal_path()   X-Ref
No description

test_set_state_cannot_skip_one()   X-Ref
No description

test_header_printed_false_initially()   X-Ref
No description

test_header_printed_becomes_true()   X-Ref
No description

test_set_context()   X-Ref
No description

test_pagetype_defaults_to_script()   X-Ref
No description

test_set_pagetype()   X-Ref
No description

test_initialise_default_pagetype()   X-Ref
No description

test_initialise_default_pagetype_fp()   X-Ref
No description

test_get_body_classes_empty()   X-Ref
No description

test_get_body_classes_single()   X-Ref
No description

test_get_body_classes()   X-Ref
No description

test_url_to_class_name()   X-Ref
No description

test_set_docs_path()   X-Ref
No description

test_docs_path_defaults_from_pagetype()   X-Ref
No description

test_set_url_root()   X-Ref
No description

test_set_url_one_param()   X-Ref
No description

test_set_url_two_params()   X-Ref
No description

test_set_url_using_moodle_url()   X-Ref
No description

test_set_url_sets_page_type()   X-Ref
No description

test_set_url_does_not_change_explicit_page_type()   X-Ref
No description

test_set_subpage()   X-Ref
No description

test_set_heading()   X-Ref
No description

test_set_title()   X-Ref
No description

test_default_pagelayout()   X-Ref
No description

test_set_pagelayout()   X-Ref
No description

test_setting_course_sets_context()   X-Ref
No description

test_set_category_top_level()   X-Ref
No description

test_set_nested_categories()   X-Ref
No description

test_cm_null_initially()   X-Ref
No description

test_set_cm()   X-Ref
No description

test_cannot_set_activity_record_before_cm()   X-Ref
No description

test_setting_cm_sets_context()   X-Ref
No description

test_activity_record_loaded_if_not_set()   X-Ref
No description

test_set_activity_record()   X-Ref
No description

test_cannot_set_inconsistent_activity_record_course()   X-Ref
No description

test_cannot_set_inconsistent_activity_record_instance()   X-Ref
No description

test_setting_cm_sets_course()   X-Ref
No description

test_set_cm_with_course_and_activity_no_db()   X-Ref
No description

test_cannot_set_cm_with_inconsistent_course()   X-Ref
No description

test_get_activity_name()   X-Ref
No description

test_user_is_editing_on()   X-Ref
No description

test_user_is_editing_off()   X-Ref
No description

test_default_editing_capabilities()   X-Ref
No description

test_other_block_editing_cap()   X-Ref
No description

test_other_editing_cap()   X-Ref
No description

test_other_editing_caps()   X-Ref
No description

test_get_renderer()   X-Ref
Test getting a renderer.


test_get_renderer_maintenance()   X-Ref
Tests getting a renderer with a maintenance layout.

This layout has special hacks in place in order to deliver a "maintenance" renderer.

test_render_to_cli()   X-Ref
No description

test_cohort_get_user_theme($usertheme, $sitetheme, $cohortthemes, $expected)   X-Ref
Validate the theme value depending on the user theme and cohorts.


get_user_theme_provider()   X-Ref
Some user cases for validating the expected theme depending on the cohorts, site and user values.

The result is an array of:
'User case description' => [
'usertheme' => '', // User theme.
'sitetheme' => '', // Site theme.
'cohorts' => [],   // Cohort themes.
'expected' => '',  // Expected value returned by cohort_get_user_cohort_theme.
]

return: array

Class: testable_moodle_page  - X-Ref

Test-specific subclass to make some protected things public.

initialise_default_pagetype($script = null)   X-Ref
No description

url_to_class_name($url)   X-Ref
No description

all_editing_caps()   X-Ref
No description