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 401 and 402] [Versions 401 and 403]

(no description)

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

Defines 1 class

get_state_test:: (6 methods):
  setupBeforeClass()
  setUp()
  tearDown()
  test_get_state()
  get_state_provider()
  create_activity()


Class: get_state_test  - X-Ref

Tests for the get_state class.

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


setUp()   X-Ref
Setup testcase.


tearDown()   X-Ref
Test tearDown.


test_get_state(string $role, string $format = 'topics', ?string $expectedexception = null)   X-Ref
Test the behaviour of get_state::execute().

param: string $role The role of the user that will execute the method.
param: string $format The course format of the course where the method will be executed.
param: string|null $expectedexception If this call will raise an exception, this is its name.

get_state_provider()   X-Ref
Data provider for test_get_state().

return: array

create_activity(int $courseid, string $type, int $section, bool $visible = true, bool $canedit = true)   X-Ref
Helper method to create an activity into a section and add it to the $sections and $activities arrays.
For non-admin users, only visible activities will be added to the activities and sections arrays.

param: int $courseid Course identifier where the activity will be added.
param: string $type Activity type ('forum', 'assign', ...).
param: int $section Section number where the activity will be added.
param: bool $visible Whether the activity will be visible or not.
param: bool $canedit Whether the activity will be accessed later by a user with editing capabilities