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.

Data provider tests.

Copyright: 2018 Marina Glancy
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 654 lines (28 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: provider_test  - X-Ref

Data provider testcase class.

setUp()   X-Ref
Set up for each test.

There are three users and four wikis.
1 : collaborative wiki, has context $this->contexts[1] and has a single subwiki $this->subwikis[1]
2 : individual wiki, has context $this->contexts[2] and three subwikis (one for each user):
$this->subwikis[21], $this->subwikis[22], $this->subwikis[23],
the subwiki for the third user is empty
3 : collaborative wiki, has context $this->contexts[3] and has a single subwiki $this->subwikis[3]
4 : collaborative wiki, has context $this->contexts[4], this wiki is empty

Each subwiki (except for "23") has pages, for example, in $this->subwiki[1] there are pages
$this->pages[1][1], $this->pages[1][2] and $this->pages[1][3]
In the export data they have paths:
$this->pagepaths[1][1], $this->pagepaths[1][2], $this->pagepaths[1][3]

create_first_page($wiki, $record = [])   X-Ref
Generate first page in wiki as current user

param: stdClass $wiki
param: array $record
return: mixed

create_page($wiki, $record = [])   X-Ref
Generate a page in wiki as current user

param: stdClass $wiki
param: array $record
return: mixed

update_page($wiki, $page, $record = [])   X-Ref
Update an existing page in wiki as current user

param: stdClass $wiki
param: stdClass $page
param: array $record
return: mixed

attach_file($wiki, $filename, $filecontent)   X-Ref
Attach file to a wiki as a current user

param: stdClass $wiki
param: string $filename
param: string $filecontent
return: stored_file

test_get_contexts_for_userid()   X-Ref
Test getting the contexts for a user.


test_get_users_in_context()   X-Ref
Test getting the users within a context.


test_export_user_data1()   X-Ref
Export data for user 1


test_export_user_data2()   X-Ref
Test export data for user 2


test_export_user_data3()   X-Ref
Test export data for user 3 (locks, empty individual wiki)


add_comment($page, $text)   X-Ref
Creates a comment object

param: stdClass $page
param: string   $text
return: comment The comment object.

test_export_user_data_with_comments()   X-Ref
Test export data when there are comments.


test_delete_data_for_all_users_in_context()   X-Ref
Test for delete_data_for_all_users_in_context().


test_delete_data_for_user()   X-Ref
Test for delete_data_for_user().


test_delete_data_for_users()   X-Ref
Test for delete_data_for_users().