Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]
Unit Tests for the Moodle Content Writer.
Copyright: | 2018 Andrew Nicols <andrew@nicols.co.uk> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 1649 lines (63 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
moodle_content_writer_test:: (40 methods):
test_export_data()
test_export_data_different_context()
test_export_data_writes_to_multiple_context()
test_export_data_multiple_writes_same_context()
export_data_provider()
test_export_metadata()
test_export_metadata_additive()
test_export_metadata_to_multiple_contexts()
export_metadata_provider()
test_export_area_files()
test_export_file()
export_file_provider()
test_export_user_preference_context_user()
test_export_user_preference_context_coursecat()
test_export_user_preference_context_course()
test_export_user_preference_context_module()
test_export_user_preference_context_block()
test_export_user_preference_context_block_multiple_instances()
test_export_user_preference_context_system()
test_export_multiple_user_preference_context_system()
test_export_user_preference_replace()
export_user_preference_provider()
test_export_data_unescaped_unicode()
test_export_metadata_unescaped_unicode()
test_export_related_data_unescaped_unicode()
test_export_related_data_clean_name()
test_export_user_preference_unescaped_unicode()
unescaped_unicode_export_provider()
test_export_data_clean_subcontext()
test_export_data_long_filename()
test_export_related_data_long_filename()
test_export_metadata_long_filename()
test_export_user_preference_long_filename()
long_filename_provider()
get_writer_instance()
fetch_exported_content()
get_context_path()
test_rewrite_pluginfile_urls()
rewrite_pluginfile_urls_provider()
test_export_html_functions()
Class: moodle_content_writer_test - X-Ref
Tests for the \core_privacy API's moodle_content_writer functionality.test_export_data($data) X-Ref |
Test that exported data is saved correctly within the system context. param: \stdClass $data Data |
test_export_data_different_context($data) X-Ref |
Test that exported data is saved correctly for context/subcontext. param: \stdClass $data Data |
test_export_data_writes_to_multiple_context() X-Ref |
Test that exported is saved within the correct directory locations. |
test_export_data_multiple_writes_same_context() X-Ref |
Test that multiple writes to the same location cause the latest version to be written. |
export_data_provider() X-Ref |
Data provider for exporting user data. |
test_export_metadata($key, $value, $description) X-Ref |
Test that metadata can be set. param: string $key Key param: string $value Value param: string $description Description |
test_export_metadata_additive() X-Ref |
Test that metadata can be set additively. |
test_export_metadata_to_multiple_contexts() X-Ref |
Test that metadata can be set additively. |
export_metadata_provider() X-Ref |
Data provider for exporting user metadata. return array |
test_export_area_files() X-Ref |
Exporting a single stored_file should cause that file to be output in the files directory. |
test_export_file($filearea, $itemid, $filepath, $filename, $content) X-Ref |
Exporting a single stored_file should cause that file to be output in the files directory. param: string $filearea File area param: int $itemid Item ID param: string $filepath File path param: string $filename File name param: string $content Content |
export_file_provider() X-Ref |
Data provider for the test_export_file function. return: array |
test_export_user_preference_context_user($component, $key, $value, $desc) X-Ref |
User preferences can be exported against a user. param: string $component Component param: string $key Key param: string $value Value param: string $desc Description |
test_export_user_preference_context_coursecat($component, $key, $value, $desc) X-Ref |
User preferences can be exported against a course category. param: string $component Component param: string $key Key param: string $value Value param: string $desc Description |
test_export_user_preference_context_course($component, $key, $value, $desc) X-Ref |
User preferences can be exported against a course. param: string $component Component param: string $key Key param: string $value Value param: string $desc Description |
test_export_user_preference_context_module($component, $key, $value, $desc) X-Ref |
User preferences can be exported against a module context. param: string $component Component param: string $key Key param: string $value Value param: string $desc Description |
test_export_user_preference_context_block($component, $key, $value, $desc) X-Ref |
User preferences can not be exported against a block context. param: string $component Component param: string $key Key param: string $value Value param: string $desc Description |
test_export_user_preference_context_block_multiple_instances() X-Ref |
Writing user preferences for two different blocks with the same name and same parent context should generate two different context paths and export files. |
test_export_user_preference_context_system($component, $key, $value, $desc) X-Ref |
User preferences can be exported against the system. param: string $component Component param: string $key Key param: string $value Value param: string $desc Description |
test_export_multiple_user_preference_context_system() X-Ref |
User preferences can be exported against the system. |
test_export_user_preference_replace() X-Ref |
User preferences can be exported against the system. |
export_user_preference_provider() X-Ref |
Provider for various user preferences. return: array |
test_export_data_unescaped_unicode($text) X-Ref |
Test that exported data is human readable. param: string $text |
test_export_metadata_unescaped_unicode($text) X-Ref |
Test that exported metadata is human readable. param: string $text |
test_export_related_data_unescaped_unicode($text) X-Ref |
Test that exported related data is human readable. param: string $text |
test_export_related_data_clean_name() X-Ref |
Test that exported related data name is properly cleaned |
test_export_user_preference_unescaped_unicode($text) X-Ref |
Test that exported user preference is human readable. param: string $text |
unescaped_unicode_export_provider() X-Ref |
Provider for various user preferences. return: array |
test_export_data_clean_subcontext() X-Ref |
Test that exported data subcontext is properly cleaned |
test_export_data_long_filename($longtext, $expected, $text) X-Ref |
Test that exported data is shortened when exceeds the limit. param: string $longtext param: string $expected param: string $text |
test_export_related_data_long_filename($longtext, $expected, $text) X-Ref |
Test that exported related data is shortened when exceeds the limit. param: string $longtext param: string $expected param: string $text |
test_export_metadata_long_filename($longtext, $expected, $text) X-Ref |
Test that exported metadata is shortened when exceeds the limit. param: string $longtext param: string $expected param: string $text |
test_export_user_preference_long_filename($longtext, $expected, $text) X-Ref |
Test that exported user preference is shortened when exceeds the limit. param: string $longtext param: string $expected param: string $text |
long_filename_provider() X-Ref |
Provider for long filenames. return: array |
get_writer_instance() X-Ref |
Get a fresh content writer. return: moodle_content_writer |
fetch_exported_content(moodle_content_writer $writer) X-Ref |
Fetch the exported content for inspection. param: moodle_content_writer $writer return: \org\bovigo\vfs\vfsStreamDirectory |
get_context_path($context, $subcontext = null, $name = '') X-Ref |
Determine the path for the current context. Note: This is a wrapper around the real function. param: \context $context The context being written param: array $subcontext The subcontext path param: string $name THe name of the file target return: array The context path. |
test_rewrite_pluginfile_urls($filearea, $itemid, $input, $expectedoutput) X-Ref |
Test correct rewriting of @@PLUGINFILE@@ in the exported contents. param: string $filearea The filearea within that component. param: int $itemid Which item those files belong to. param: string $input Raw text as stored in the database. param: string $expectedoutput Expected output of URL rewriting. |
rewrite_pluginfile_urls_provider() X-Ref |
Provides testable sample data for {@link self::test_rewrite_pluginfile_urls()}. return: array |
test_export_html_functions() X-Ref |
No description |