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: tests_content_writer_test  - X-Ref

Unit Tests for the Content Writer used for unit testing.

test_export_data()   X-Ref
It should be possible to store and retrieve data.


test_export_data_no_context_clash()   X-Ref
It should be possible to store and retrieve data at the same point in different contexts.


test_get_data_with_children()   X-Ref
Test export and recover with children.


test_export_metadata()   X-Ref
It should be possible to store and retrieve metadata.


test_export_metadata_no_context_clash()   X-Ref
It should be possible to store and retrieve metadata at the same point in different contexts.


test_export_user_preference()   X-Ref
It should be possible to store and retrieve user preferences.


test_export_user_preference_no_context_clash()   X-Ref
It should be possible to store and retrieve user preferences at the same point in different contexts.


test_get_metadata_with_children()   X-Ref
Test export and recover with children.


test_export_file_special_folders()   X-Ref
It should be possible to export files in the files and children contexts.


test_export_file_no_context_clash()   X-Ref
It should be possible to export mutliple files in the same subcontext/path space but different context and not
have them clash.


test_get_file_with_children()   X-Ref
Test export and recover with children.


test_export_related_data()   X-Ref
It should be possible to export related data in the files and children contexts.


test_export_related_data_no_context_clash()   X-Ref
It should be possible to export related data in the same location,but in a different context.


test_get_related_data_with_children()   X-Ref
Test export and recover with children.


test_export_custom_file()   X-Ref
It should be possible to export related files in the files and children contexts.


test_export_custom_file_no_context_clash()   X-Ref
It should be possible to export related files in the same location
in different contexts.


test_get_custom_file_with_children()   X-Ref
Test export and recover with children.


get_writer_instance()   X-Ref
Get a fresh content writer.

return: moodle_content_writer

get_stored_file($filepath, $filename)   X-Ref
Helper to create a stored file objectw with the given supplied content.

param: string  $filepath The file path to use in the stored_file
param: string  $filename The file name to use in the stored_file
return: stored_file