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.

Class: conversion_test  - X-Ref

PHPUnit tests for conversion persistent.

create_stored_file($filecontent = 'content', $filename = 'testfile.txt', $filerecord = [])   X-Ref
Helper to create a stored file object with the given supplied content.

param: string $filecontent The content of the mocked file
param: string $filename The file name to use in the stored_file
param: string $filerecord Any overrides to the filerecord
return: stored_file

test_get_conversions_for_file_existing_conversion_incomplete()   X-Ref
Ensure that get_conversions_for_file returns an existing conversion
record with matching sourcefileid and targetformat.


test_get_conversions_for_multiple_files_existing_conversion_incomplete()   X-Ref
Ensure that get_conversions_for_file returns an existing conversion
record with matching sourcefileid and targetformat when a file with the same
contenthash is uploaded several times.


test_get_conversions_for_file_existing_conversion_multiple_formats_incomplete()   X-Ref
Ensure that get_conversions_for_file returns an existing conversion
record with matching sourcefileid and targetformat when a second
conversion to a different format exists.


test_get_conversions_for_file_existing_conversion_complete()   X-Ref
Ensure that get_conversions_for_file returns an existing conversion
record with matching sourcefileid and targetformat.


test_get_conversions_for_file_existing_conversion_multiple_formats_complete()   X-Ref
Ensure that get_conversions_for_file returns an existing conversion
record with matching sourcefileid and targetformat.


test_get_conversions_for_file_existing_target()   X-Ref
Ensure that get_conversions_for_file returns an existing conversion
record does not exist, but the file has previously been converted.


test_set_sourcefile()   X-Ref
Ensure that set_sourcefile sets the correct fileid.


test_store_destfile_from_path()   X-Ref
Ensure that store_destfile_from_path stores the file as expected.


test_store_destfile_from_path_delete_existing()   X-Ref
Ensure that store_destfile_from_path stores the file as expected.


test_store_destfile_from_string()   X-Ref
Ensure that store_destfile_from_path stores the file as expected.


test_store_destfile_from_string_delete_existing()   X-Ref
Ensure that store_destfile_from_string stores the file as expected when
an existing destfile is found.


test_get_status()   X-Ref
Ensure that the get_status functions cast the status to integer correctly.


test_get_converter_instance_none_set()   X-Ref
Ensure that get_converter_instance returns false when no converter is set.


test_get_converter_instance_invalid_set()   X-Ref
Ensure that get_converter_instance returns false when no valid converter is set.


test_get_converter_instance_valid_set()   X-Ref
Ensure that get_converter_instance returns an instance when a valid converter is set.


test_remove_old_conversion_records_old()   X-Ref
Test that all old conversion records are removed periodically.


test_remove_old_conversion_records_young()   X-Ref
Test that all old conversion records are removed periodically.


test_remove_orphan_records()   X-Ref
Test orphan records are removed.