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 39 and 401]

Unit Tests for the Content Writer used for unit testing.

Copyright: 2018 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 540 lines (22 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


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