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 403]

Test for content bank contenttype class.

Copyright: 2020 Amaia Anabitarte <amaia@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 674 lines (26 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: contenttype_test  - X-Ref

Test for content bank contenttype class.

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


test_get_contenttype_name()   X-Ref
Tests get_contenttype_name result.


test_get_plugin_name()   X-Ref
Tests get_plugin_name result.


test_get_icon()   X-Ref
Tests get_icon result.


test_is_feature_supported()   X-Ref
Tests is_feature_supported behavior .


test_no_upload_feature_supported()   X-Ref
Tests can_upload behavior with no implemented upload feature.


test_create_empty_content()   X-Ref
Test create_content() with empty data.


test_create_content()   X-Ref
Tests for behaviour of create_content() with data.


test_upload_content(bool $userecord)   X-Ref
Tests for behaviour of upload_content() with a file and a record.

param: bool $userecord if a predefined record has to be used.

upload_content_provider()   X-Ref
Data provider for test_rename_content.

return: array

test_upload_content_exception()   X-Ref
Tests for behaviour of upload_content() with a file wrong file.


test_replace_content()   X-Ref
Tests for behaviour of replace_content() using a dummy file.


test_replace_content_exception()   X-Ref
Tests for behaviour of replace_content() using an error file.


test_can_delete()   X-Ref
Test the behaviour of can_delete().


test_delete_content()   X-Ref
Test the behaviour of delete_content().


contenttype_setup_scenario_data(string $contenttype = 'contenttype_testable')   X-Ref
Helper function to setup 3 users (manager1, manager2 and user) and 4 contents (3 created by manager1 and 1 by user).


rename_content_provider()   X-Ref
Data provider for test_rename_content.

return: array

test_rename_content(string $newname, string $expected, bool $result)   X-Ref
Test the behaviour of rename_content().

param: string  $newname    The name to set
param: string   $expected   The name result
param: bool   $result   The bolean result expected when renaming

test_move_content()   X-Ref
Test the behaviour of move_content().


test_can_manage()   X-Ref
Test the behaviour of can_manage().


test_can_download()   X-Ref
Test the behaviour of can_download().


test_get_download_url()   X-Ref
Tests get_download_url result.


test_pluginfile()   X-Ref
Tests pluginfile result.