Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Class: core_contentbank_testcase  - X-Ref

Test for extensions manager.

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


get_extension_provider()   X-Ref
Data provider for test_get_extension_supporter.

return: array

test_get_extension(string $filename, string $expected)   X-Ref
Tests for get_extension() function.

param: string  $filename    The filename given
param: string   $expected   The extension of the file

get_extension_supporters_provider()   X-Ref
Data provider for test_load_context_supported_extensions.

return: array

test_get_extension_supporter_for_admins(array $supporters, string $extension, string $expected)   X-Ref
Tests for get_extension_supporter() function with admin permissions.

param: array   $supporters   The content type plugin supporters for each extension
param: string  $extension    The extension of the file given
param: string  $expected   The supporter contenttype of the file

test_get_extension_supporter_for_users(array $supporters, string $extension, string $expected)   X-Ref
Tests for get_extension_supporter() function with user default permissions.

param: array   $supporters   The content type plugin supporters for each extension
param: string  $extension    The extension of the file given
param: string  $expected   The supporter contenttype of the file

test_get_extension_supporter_for_teachers(array $supporters, string $extension, string $expected)   X-Ref
Tests for get_extension_supporter() function with teacher defaul permissions.

param: array   $supporters   The content type plugin supporters for each extension
param: string  $extension    The extension of the file given
param: string  $expected   The supporter contenttype of the file

test_get_extension_supporter(array $supporters, string $extension, string $expected)   X-Ref
Tests for get_extension_supporter() function.

param: array   $supporters   The content type plugin supporters for each extension
param: string  $extension    The extension of the file given
param: string  $expected   The supporter contenttype of the file

test_search_contents(?string $search, string $where, int $expectedresult, array $contexts = [],array $contenttypes = null)   X-Ref
Test the behaviour of search_contents().

param: string $search String to search.
param: string $where Context where to search.
param: int $expectedresult Expected result.
param: array $contexts List of contexts where to create content.

search_contents_provider()   X-Ref
Data provider for test_search_contents().

return: array

test_create_content_from_file()   X-Ref
Test create_content_from_file function.


test_delete_contents()   X-Ref
Test the behaviour of delete_contents().


test_delete_contents_for_empty_contentbank()   X-Ref
Test the behaviour of delete_contents() for empty content bank.


test_move_contents()   X-Ref
Test the behaviour of move_contents().


test_move_contents_for_empty_contentbank()   X-Ref
Test the behaviour of move_contents() for empty content bank.


get_contenttypes_with_capability_feature_provider()   X-Ref
Data provider for get_contenttypes_with_capability_feature.

return: array

test_get_contenttypes_with_capability_feature(array $contenttypesenabled, array $contenttypescanfeature)   X-Ref
Tests for get_contenttypes_with_capability_feature() function.

param: array $contenttypesenabled Content types enabled.
param: array $contenttypescanfeature Content types the user has the permission to use the feature.

test_get_content_from_id()   X-Ref
Test the behaviour of get_content_from_id()


test_is_context_allowed(\Closure $getcontext, bool $expectedresult)   X-Ref
Test the behaviour of is_context_allowed().

param: \Closure $getcontext Get the context to check.
param: bool $expectedresult Expected result.

context_provider()   X-Ref
Data provider for test_is_context_allowed().

return: array