Merge branch 'MDL-70070-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE
This commit is contained in:
@@ -33,8 +33,7 @@ class store_test extends \advanced_testcase {
|
||||
* Tests log writing.
|
||||
*
|
||||
* @param bool $jsonformat True to test with JSON format
|
||||
* @dataProvider test_log_writing_provider
|
||||
* @throws moodle_exception
|
||||
* @dataProvider log_writing_provider
|
||||
*/
|
||||
public function test_log_writing(bool $jsonformat) {
|
||||
global $DB, $CFG;
|
||||
@@ -252,9 +251,9 @@ class store_test extends \advanced_testcase {
|
||||
* Returns different JSON format settings so the test can be run with JSON format either on or
|
||||
* off.
|
||||
*
|
||||
* @return [bool] Array of true/false
|
||||
* @return bool[] Array of true/false
|
||||
*/
|
||||
public static function test_log_writing_provider(): array {
|
||||
public static function log_writing_provider(): array {
|
||||
return [
|
||||
[false],
|
||||
[true]
|
||||
|
||||
@@ -38,8 +38,7 @@ class store_test extends \advanced_testcase {
|
||||
* Tests log writing.
|
||||
*
|
||||
* @param bool $jsonformat True to test with JSON format
|
||||
* @dataProvider test_log_writing_provider
|
||||
* @throws moodle_exception
|
||||
* @dataProvider log_writing_provider
|
||||
*/
|
||||
public function test_log_writing(bool $jsonformat) {
|
||||
global $DB;
|
||||
@@ -223,9 +222,9 @@ class store_test extends \advanced_testcase {
|
||||
* Returns different JSON format settings so the test can be run with JSON format either on or
|
||||
* off.
|
||||
*
|
||||
* @return [bool] Array of true/false
|
||||
* @return bool[] Array of true/false
|
||||
*/
|
||||
public static function test_log_writing_provider(): array {
|
||||
public static function log_writing_provider(): array {
|
||||
return [
|
||||
[false],
|
||||
[true]
|
||||
@@ -368,7 +367,7 @@ class store_test extends \advanced_testcase {
|
||||
* Tests the decode_other function can cope with both JSON and PHP serialized format.
|
||||
*
|
||||
* @param mixed $value Value to encode and decode
|
||||
* @dataProvider test_decode_other_provider
|
||||
* @dataProvider decode_other_provider
|
||||
*/
|
||||
public function test_decode_other($value) {
|
||||
$this->assertEquals($value, \logstore_standard\log\store::decode_other(serialize($value)));
|
||||
@@ -387,7 +386,7 @@ class store_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array Array of parameters
|
||||
*/
|
||||
public function test_decode_other_provider(): array {
|
||||
public function decode_other_provider(): array {
|
||||
return [
|
||||
[['info' => 'd2819896', 'logurl' => 'discuss.php?d=2819896']],
|
||||
[null],
|
||||
@@ -400,8 +399,7 @@ class store_test extends \advanced_testcase {
|
||||
* Checks that backup and restore of log data works correctly.
|
||||
*
|
||||
* @param bool $jsonformat True to test with JSON format
|
||||
* @dataProvider test_log_writing_provider
|
||||
* @throws moodle_exception
|
||||
* @dataProvider log_writing_provider
|
||||
*/
|
||||
public function test_backup_restore(bool $jsonformat) {
|
||||
global $DB;
|
||||
|
||||
@@ -378,7 +378,7 @@ class condition_test extends \advanced_testcase {
|
||||
/**
|
||||
* Tests the is_available and get_description functions for previous activity option.
|
||||
*
|
||||
* @dataProvider test_previous_activity_data
|
||||
* @dataProvider previous_activity_data
|
||||
* @param int $grade the current assign grade (0 for none)
|
||||
* @param int $condition true for complete, false for incomplete
|
||||
* @param string $mark activity to mark as complete
|
||||
@@ -467,7 +467,7 @@ class condition_test extends \advanced_testcase {
|
||||
$this->assertMatchesRegularExpression($description, $information);
|
||||
}
|
||||
|
||||
public function test_previous_activity_data(): array {
|
||||
public function previous_activity_data(): array {
|
||||
// Assign grade, condition, activity to complete, activity to test, result, resultnot, description.
|
||||
return [
|
||||
'Missing previous activity complete' => [
|
||||
@@ -559,7 +559,7 @@ class condition_test extends \advanced_testcase {
|
||||
* Tests the is_available and get_description functions for
|
||||
* previous activity option in course sections.
|
||||
*
|
||||
* @dataProvider test_section_previous_activity_data
|
||||
* @dataProvider section_previous_activity_data
|
||||
* @param int $condition condition value
|
||||
* @param bool $mark if Page 1 must be mark as completed
|
||||
* @param string $section section to add the availability
|
||||
@@ -632,7 +632,7 @@ class condition_test extends \advanced_testcase {
|
||||
|
||||
}
|
||||
|
||||
public function test_section_previous_activity_data(): array {
|
||||
public function section_previous_activity_data(): array {
|
||||
return [
|
||||
// Condition, Activity completion, section to test, result, resultnot, description.
|
||||
'Completion complete Section with no previous activity' => [
|
||||
|
||||
@@ -2624,7 +2624,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function test_get_calendar_event_by_id_prevent_read_other_users_events_data_provider(): array {
|
||||
public function get_calendar_event_by_id_prevent_read_other_users_events_data_provider(): array {
|
||||
$syscontext = \context_system::instance();
|
||||
$managerrole = 'manager';
|
||||
return [
|
||||
@@ -2639,7 +2639,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
* Prevent user from reading other user's event.
|
||||
*
|
||||
* @covers \core_calendar_external::get_calendar_event_by_id
|
||||
* @dataProvider test_get_calendar_event_by_id_prevent_read_other_users_events_data_provider
|
||||
* @dataProvider get_calendar_event_by_id_prevent_read_other_users_events_data_provider
|
||||
*
|
||||
* @param bool $isadminevent Is admin's event
|
||||
* @param bool $isadmin Is current user admin user
|
||||
@@ -2695,7 +2695,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function test_edit_or_delete_other_users_events_data_provider(): array {
|
||||
public function edit_or_delete_other_users_events_data_provider(): array {
|
||||
$syscontext = \context_system::instance();
|
||||
$managerrole = 'manager';
|
||||
return [
|
||||
@@ -2709,7 +2709,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test the behavior of deleting other users' user events.
|
||||
*
|
||||
* @dataProvider test_edit_or_delete_other_users_events_data_provider
|
||||
* @dataProvider edit_or_delete_other_users_events_data_provider
|
||||
* @covers \core_calendar_external::delete_calendar_events
|
||||
* @param bool $isadmin Whether the current user is admin.
|
||||
* @param bool $isadminevent Whether it's an admin event or not.
|
||||
@@ -2756,7 +2756,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test the behavior of editing other users' user events
|
||||
*
|
||||
* @dataProvider test_edit_or_delete_other_users_events_data_provider
|
||||
* @dataProvider edit_or_delete_other_users_events_data_provider
|
||||
* @covers \core_calendar_external::submit_create_update_form
|
||||
* @param bool $isadmin Whether the current user is admin.
|
||||
* @param bool $isadminevent Whether it's an admin event or not.
|
||||
|
||||
@@ -49,7 +49,7 @@ class std_proxy_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test proxying.
|
||||
*
|
||||
* @dataProvider test_proxy_testcases()
|
||||
* @dataProvider proxy_testcases
|
||||
* @param int $id Object ID.
|
||||
* @param string $member Object member to retrieve.
|
||||
* @param mixed $expected Expected value of member.
|
||||
@@ -65,7 +65,7 @@ class std_proxy_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test setting values with a base class.
|
||||
*
|
||||
* @dataProvider test_proxy_testcases()
|
||||
* @dataProvider proxy_testcases
|
||||
* @param int $id Object ID.
|
||||
* @param string $member Object member to retrieve.
|
||||
* @param mixed $storedvalue Value as would be stored externally.
|
||||
@@ -86,7 +86,7 @@ class std_proxy_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test getting a non existant member.
|
||||
*
|
||||
* @dataProvider test_get_set_testcases()
|
||||
* @dataProvider get_set_testcases
|
||||
* @param int $id ID of the object being proxied.
|
||||
*/
|
||||
public function test_get_invalid_member($id) {
|
||||
@@ -101,7 +101,7 @@ class std_proxy_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test get proxied instance.
|
||||
*
|
||||
* @dataProvider test_get_set_testcases()
|
||||
* @dataProvider get_set_testcases
|
||||
* @param int $id Object ID.
|
||||
*/
|
||||
public function test_get_proxied_instance($id) {
|
||||
@@ -115,7 +115,7 @@ class std_proxy_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test cases for proxying test.
|
||||
*/
|
||||
public function test_proxy_testcases() {
|
||||
public function proxy_testcases() {
|
||||
return [
|
||||
'Object 1 member 1' => [
|
||||
1,
|
||||
@@ -153,7 +153,7 @@ class std_proxy_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test cases for getting and setting tests.
|
||||
*/
|
||||
public function test_get_set_testcases() {
|
||||
public function get_set_testcases() {
|
||||
return [
|
||||
'Object 1' => [1],
|
||||
'Object 2' => [5]
|
||||
|
||||
@@ -14,15 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Provides the {@link filter_mathjaxloader_filter_testcase} class.
|
||||
*
|
||||
* @package filter_mathjaxloader
|
||||
* @category test
|
||||
* @copyright 2017 David Mudrák <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace filter_mathjaxloader;
|
||||
|
||||
use filter_mathjaxloader;
|
||||
@@ -35,6 +26,8 @@ require_once($CFG->dirroot.'/filter/mathjaxloader/filter.php');
|
||||
/**
|
||||
* Unit tests for the MathJax loader filter.
|
||||
*
|
||||
* @package filter_mathjaxloader
|
||||
* @category test
|
||||
* @copyright 2017 David Mudrak <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
@@ -46,7 +39,7 @@ class filter_test extends \advanced_testcase {
|
||||
* @param string $moodlelangcode the user's current language
|
||||
* @param string $mathjaxlangcode the mathjax language to be used for the moodle language
|
||||
*
|
||||
* @dataProvider test_map_language_code_expected_mappings
|
||||
* @dataProvider map_language_code_expected_mappings
|
||||
*/
|
||||
public function test_map_language_code($moodlelangcode, $mathjaxlangcode) {
|
||||
|
||||
@@ -59,7 +52,7 @@ class filter_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array of [moodlelangcode, mathjaxcode] tuples
|
||||
*/
|
||||
public function test_map_language_code_expected_mappings() {
|
||||
public function map_language_code_expected_mappings() {
|
||||
|
||||
return [
|
||||
['cz', 'cs'], // Explicit mapping.
|
||||
|
||||
@@ -38,7 +38,7 @@ class filtermath_test extends \advanced_testcase {
|
||||
* @param string $inputtext The text given by the user.
|
||||
* @param string $expected The expected output after filtering.
|
||||
*
|
||||
* @dataProvider test_math_filtering_inputs
|
||||
* @dataProvider math_filtering_inputs
|
||||
*/
|
||||
public function test_math_filtering($inputtext, $expected) {
|
||||
$filter = new filter_mathjaxloader(\context_system::instance(), []);
|
||||
@@ -50,7 +50,7 @@ class filtermath_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array of [inputtext, expectedoutput] tuples.
|
||||
*/
|
||||
public function test_math_filtering_inputs() {
|
||||
public function math_filtering_inputs() {
|
||||
return [
|
||||
// One inline formula.
|
||||
['Some inline math \\( y = x^2 \\).',
|
||||
|
||||
@@ -14,15 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Testing the H5PFrameworkInterface interface implementation.
|
||||
*
|
||||
* @package core_h5p
|
||||
* @category test
|
||||
* @copyright 2019 Mihail Geshoski <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace core_h5p;
|
||||
|
||||
use core_collator;
|
||||
@@ -34,6 +25,7 @@ use Moodle\H5PDisplayOptionBehaviour;
|
||||
* Test class covering the H5PFrameworkInterface interface implementation.
|
||||
*
|
||||
* @package core_h5p
|
||||
* @category test
|
||||
* @copyright 2019 Mihail Geshoski <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @runTestsInSeparateProcesses
|
||||
@@ -638,7 +630,7 @@ class framework_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the behaviour of isPatchedLibrary().
|
||||
*
|
||||
* @dataProvider test_isPatchedLibrary_provider
|
||||
* @dataProvider isPatchedLibrary_provider
|
||||
* @param array $libraryrecords Array containing data for the library creation
|
||||
* @param array $testlibrary Array containing the test library data
|
||||
* @param bool $expected The expectation whether the library is patched or not
|
||||
@@ -660,7 +652,7 @@ class framework_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function test_isPatchedLibrary_provider(): array {
|
||||
public function isPatchedLibrary_provider(): array {
|
||||
return [
|
||||
'Unpatched library. No different versioning' => [
|
||||
[
|
||||
@@ -1416,7 +1408,7 @@ class framework_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the behaviour of loadLibrarySemantics().
|
||||
*
|
||||
* @dataProvider test_loadLibrarySemantics_provider
|
||||
* @dataProvider loadLibrarySemantics_provider
|
||||
* @param array $libraryrecords Array containing data for the library creation
|
||||
* @param array $testlibrary Array containing the test library data
|
||||
* @param string $expected The expected semantics value
|
||||
@@ -1439,7 +1431,7 @@ class framework_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function test_loadLibrarySemantics_provider(): array {
|
||||
public function loadLibrarySemantics_provider(): array {
|
||||
|
||||
$semantics = json_encode(
|
||||
[
|
||||
@@ -2208,7 +2200,7 @@ class framework_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the behaviour of test_libraryHasUpgrade().
|
||||
*
|
||||
* @dataProvider test_libraryHasUpgrade_provider
|
||||
* @dataProvider libraryHasUpgrade_provider
|
||||
* @param array $libraryrecords Array containing data for the library creation
|
||||
* @param array $testlibrary Array containing the test library data
|
||||
* @param bool $expected The expectation whether the library is patched or not
|
||||
@@ -2230,7 +2222,7 @@ class framework_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function test_libraryHasUpgrade_provider(): array {
|
||||
public function libraryHasUpgrade_provider(): array {
|
||||
return [
|
||||
'Lower major version; Identical lower version' => [
|
||||
[
|
||||
|
||||
@@ -14,23 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Test class covering the h5p data generator class.
|
||||
*
|
||||
* @package core_h5p
|
||||
* @category test
|
||||
* @copyright 2019 Mihail Geshoski <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace core_h5p;
|
||||
|
||||
use core_h5p\local\library\autoloader;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Generator testcase for the core_grading generator.
|
||||
* Test class covering the h5p data generator class.
|
||||
*
|
||||
* @package core_h5p
|
||||
* @category test
|
||||
@@ -165,7 +154,7 @@ class generator_test extends \advanced_testcase {
|
||||
* Test the behaviour of generate_h5p_data(). Test whether library files are created or not
|
||||
* on filesystem depending what the method defines.
|
||||
*
|
||||
* @dataProvider test_generate_h5p_data_files_creation_provider
|
||||
* @dataProvider generate_h5p_data_files_creation_provider
|
||||
* @param bool $createlibraryfiles Whether to create library files on the filesystem
|
||||
* @param bool $expected The expectation whether the files have been created or not
|
||||
**/
|
||||
@@ -205,7 +194,7 @@ class generator_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function test_generate_h5p_data_files_creation_provider(): array {
|
||||
public function generate_h5p_data_files_creation_provider(): array {
|
||||
return [
|
||||
'Do not create library related files on the filesystem' => [
|
||||
false,
|
||||
@@ -261,7 +250,7 @@ class generator_test extends \advanced_testcase {
|
||||
* Test the behaviour of create_h5p_record(). Test whather the h5p content data is
|
||||
* properly saved in the database.
|
||||
*
|
||||
* @dataProvider test_create_h5p_record_provider
|
||||
* @dataProvider create_h5p_record_provider
|
||||
* @param array $h5pdata The h5p content data
|
||||
* @param \stdClass $expected The expected saved data
|
||||
**/
|
||||
@@ -287,7 +276,7 @@ class generator_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function test_create_h5p_record_provider(): array {
|
||||
public function create_h5p_record_provider(): array {
|
||||
$createdjsoncontent = json_encode(
|
||||
array(
|
||||
'text' => '<p>Created dummy text<\/p>\n',
|
||||
@@ -384,7 +373,7 @@ class generator_test extends \advanced_testcase {
|
||||
* Test the behaviour of create_contents_libraries_record(). Test whether the contents libraries
|
||||
* are properly saved in the database.
|
||||
*
|
||||
* @dataProvider test_create_contents_libraries_record_provider
|
||||
* @dataProvider create_contents_libraries_record_provider
|
||||
* @param array $contentslibrariestdata The h5p contents libraries data.
|
||||
* @param \stdClass $expected The expected saved data.
|
||||
**/
|
||||
@@ -408,7 +397,7 @@ class generator_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function test_create_contents_libraries_record_provider(): array {
|
||||
public function create_contents_libraries_record_provider(): array {
|
||||
return [
|
||||
'Create h5p content library with set dependency type' => [
|
||||
[
|
||||
@@ -444,7 +433,7 @@ class generator_test extends \advanced_testcase {
|
||||
* Test the behaviour of create_library_dependency_record(). Test whether the contents libraries
|
||||
* are properly saved in the database.
|
||||
*
|
||||
* @dataProvider test_create_library_dependency_record_provider
|
||||
* @dataProvider create_library_dependency_record_provider
|
||||
* @param array $librarydependencydata The library dependency data.
|
||||
* @param \stdClass $expected The expected saved data.
|
||||
**/
|
||||
@@ -468,7 +457,7 @@ class generator_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function test_create_library_dependency_record_provider(): array {
|
||||
public function create_library_dependency_record_provider(): array {
|
||||
return [
|
||||
'Create h5p library dependency with set dependency type' => [
|
||||
[
|
||||
@@ -499,7 +488,7 @@ class generator_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the behaviour of create_content_file(). Test whether a file belonging to a content is created.
|
||||
*
|
||||
* @dataProvider test_create_content_file_provider
|
||||
* @dataProvider create_content_file_provider
|
||||
* @param array $filedata Data from the file to be created.
|
||||
* @param array $expecteddata Data expected.Data from the file to be created.
|
||||
*/
|
||||
@@ -534,7 +523,7 @@ class generator_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
**/
|
||||
public function test_create_content_file_provider(): array {
|
||||
public function create_content_file_provider(): array {
|
||||
return [
|
||||
'Create file in content with id 4' => [
|
||||
[
|
||||
|
||||
@@ -2266,7 +2266,7 @@ class ddl_test extends \database_driver_testcase {
|
||||
*
|
||||
* @return array The type-value pair fixture.
|
||||
*/
|
||||
public function test_get_enc_quoted_provider() {
|
||||
public function get_enc_quoted_provider() {
|
||||
return array(
|
||||
// Reserved: some examples from SQL-92.
|
||||
[true, 'from'],
|
||||
@@ -2280,7 +2280,7 @@ class ddl_test extends \database_driver_testcase {
|
||||
/**
|
||||
* This is a test for sql_generator::getEncQuoted().
|
||||
*
|
||||
* @dataProvider test_get_enc_quoted_provider
|
||||
* @dataProvider get_enc_quoted_provider
|
||||
* @param bool $reserved Whether the column name is reserved or not.
|
||||
* @param string $columnname The column name to be quoted, according to the value of $reserved.
|
||||
**/
|
||||
@@ -2315,7 +2315,7 @@ class ddl_test extends \database_driver_testcase {
|
||||
*
|
||||
* @return array The type-old-new tuple fixture.
|
||||
*/
|
||||
public function test_sql_generator_get_rename_field_sql_provider() {
|
||||
public function sql_generator_get_rename_field_sql_provider() {
|
||||
return array(
|
||||
// Reserved: an example from SQL-92.
|
||||
// Both names should be reserved.
|
||||
@@ -2328,7 +2328,7 @@ class ddl_test extends \database_driver_testcase {
|
||||
/**
|
||||
* This is a unit test for sql_generator::getRenameFieldSQL().
|
||||
*
|
||||
* @dataProvider test_sql_generator_get_rename_field_sql_provider
|
||||
* @dataProvider sql_generator_get_rename_field_sql_provider
|
||||
* @param bool $reserved Whether the column name is reserved or not.
|
||||
* @param string $oldcolumnname The column name to be renamed.
|
||||
* @param string $newcolumnname The new column name.
|
||||
|
||||
@@ -134,7 +134,7 @@ TBC;
|
||||
/**
|
||||
* Data provider for the test_load function.
|
||||
*/
|
||||
public function test_load_test_cases() {
|
||||
public function load_test_cases() {
|
||||
$cache = [
|
||||
'core' => [
|
||||
'test' => '{{! a comment }}The rest of the template'
|
||||
@@ -163,7 +163,7 @@ TBC;
|
||||
/**
|
||||
* Test the load function.
|
||||
*
|
||||
* @dataProvider test_load_test_cases()
|
||||
* @dataProvider load_test_cases
|
||||
* @param mustache_template_source_loader $loader The loader
|
||||
* @param string $component The moodle component
|
||||
* @param string $name The template name
|
||||
@@ -177,7 +177,7 @@ TBC;
|
||||
/**
|
||||
* Data provider for the load_with_dependencies function.
|
||||
*/
|
||||
public function test_load_with_dependencies_test_cases() {
|
||||
public function load_with_dependencies_test_cases() {
|
||||
// Create a bunch of templates that include one another in various ways. There is
|
||||
// multiple instances of recursive inclusions to test that the code doensn't get
|
||||
// stuck in an infinite loop.
|
||||
@@ -330,7 +330,7 @@ TBC;
|
||||
/**
|
||||
* Test the load_with_dependencies function.
|
||||
*
|
||||
* @dataProvider test_load_with_dependencies_test_cases()
|
||||
* @dataProvider load_with_dependencies_test_cases
|
||||
* @param mustache_template_source_loader $loader The loader
|
||||
* @param string $component The moodle component
|
||||
* @param string $name The template name
|
||||
@@ -344,7 +344,7 @@ TBC;
|
||||
/**
|
||||
* Data provider for the test_load function.
|
||||
*/
|
||||
public function test_scan_template_source_for_dependencies_test_cases() {
|
||||
public function scan_template_source_for_dependencies_test_cases() {
|
||||
$foo = '{{! a comment }}{{> core/bar }}{{< test/bop }}{{/ test/bop}}{{#str}} help, core {{/str}}';
|
||||
$bar = '{{! a comment }}{{> core/baz }}';
|
||||
$baz = '{{! a comment }}{{#str}} hide, core {{/str}}';
|
||||
@@ -488,7 +488,7 @@ TEMPLATE;
|
||||
/**
|
||||
* Test the scan_template_source_for_dependencies function.
|
||||
*
|
||||
* @dataProvider test_scan_template_source_for_dependencies_test_cases()
|
||||
* @dataProvider scan_template_source_for_dependencies_test_cases()
|
||||
* @param mustache_template_source_loader $loader The loader
|
||||
* @param string $source The template to test
|
||||
* @param string $expected The expected output
|
||||
|
||||
@@ -14,6 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace core\plugininfo;
|
||||
|
||||
use testable_core_plugin_manager;
|
||||
use testable_plugininfo_base;
|
||||
|
||||
/**
|
||||
* Unit tests for plugin base class.
|
||||
*
|
||||
@@ -21,20 +28,6 @@
|
||||
* @copyright 2019 Andrew Nicols
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
namespace core\plugininfo;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use core_plugin_manager;
|
||||
use testable_core_plugin_manager;
|
||||
use testable_plugininfo_base;
|
||||
|
||||
|
||||
/**
|
||||
* Tests of the basic API of the plugin manager.
|
||||
*/
|
||||
class base_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
@@ -172,7 +165,7 @@ class base_test extends \advanced_testcase {
|
||||
* Test the load_disk_version function to check that it handles a range of correct supported and incompatible field
|
||||
* definitions.
|
||||
*
|
||||
* @dataProvider test_load_disk_version_branch_supports_provider
|
||||
* @dataProvider load_disk_version_branch_supports_provider
|
||||
* @param array|null $supported Supported versions to inject
|
||||
* @param string|int|null $incompatible Incompatible version to inject.
|
||||
* @param int $version Version to test
|
||||
@@ -204,7 +197,7 @@ class base_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function test_load_disk_version_branch_supports_provider(): array {
|
||||
public function load_disk_version_branch_supports_provider(): array {
|
||||
return [
|
||||
'Range, branch in support, lowest' => [
|
||||
'supported' => [29, 31],
|
||||
|
||||
@@ -29,7 +29,7 @@ require_once(__DIR__ . '/../fixtures/task_fixtures.php');
|
||||
*/
|
||||
class manager_test extends \advanced_testcase {
|
||||
|
||||
public function test_ensure_adhoc_task_qos_provider() {
|
||||
public function ensure_adhoc_task_qos_provider() {
|
||||
return [
|
||||
[
|
||||
[],
|
||||
@@ -173,7 +173,7 @@ class manager_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test that the Quality of Service reordering works.
|
||||
*
|
||||
* @dataProvider test_ensure_adhoc_task_qos_provider
|
||||
* @dataProvider ensure_adhoc_task_qos_provider
|
||||
*
|
||||
* @param array $input array of tasks
|
||||
* @param array $expected array of reordered tasks
|
||||
|
||||
@@ -5776,7 +5776,7 @@ class api_test extends messagelib_test {
|
||||
/**
|
||||
* Data provider for test_get_conversation_counts().
|
||||
*/
|
||||
public function test_get_conversation_counts_test_cases() {
|
||||
public function get_conversation_counts_test_cases() {
|
||||
$typeindividual = api::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL;
|
||||
$typegroup = api::MESSAGE_CONVERSATION_TYPE_GROUP;
|
||||
$typeself = api::MESSAGE_CONVERSATION_TYPE_SELF;
|
||||
@@ -6139,7 +6139,7 @@ class api_test extends messagelib_test {
|
||||
/**
|
||||
* Test the get_conversation_counts() function.
|
||||
*
|
||||
* @dataProvider test_get_conversation_counts_test_cases()
|
||||
* @dataProvider get_conversation_counts_test_cases
|
||||
* @param array $conversationconfigs Conversations to create
|
||||
* @param int $deletemessagesuser The user who is deleting the messages
|
||||
* @param array $deletemessages The list of messages to delete (by index)
|
||||
@@ -6262,7 +6262,7 @@ class api_test extends messagelib_test {
|
||||
/**
|
||||
* Test the get_unread_conversation_counts() function.
|
||||
*
|
||||
* @dataProvider test_get_conversation_counts_test_cases()
|
||||
* @dataProvider get_conversation_counts_test_cases
|
||||
* @param array $conversationconfigs Conversations to create
|
||||
* @param int $deletemessagesuser The user who is deleting the messages
|
||||
* @param array $deletemessages The list of messages to delete (by index)
|
||||
|
||||
@@ -5136,7 +5136,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Data provider for test_get_conversation_counts().
|
||||
*/
|
||||
public function test_get_conversation_counts_test_cases() {
|
||||
public function get_conversation_counts_test_cases() {
|
||||
$typeindividual = \core_message\api::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL;
|
||||
$typegroup = \core_message\api::MESSAGE_CONVERSATION_TYPE_GROUP;
|
||||
$typeself = \core_message\api::MESSAGE_CONVERSATION_TYPE_SELF;
|
||||
@@ -5499,7 +5499,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test the get_conversation_counts() function.
|
||||
*
|
||||
* @dataProvider test_get_conversation_counts_test_cases()
|
||||
* @dataProvider get_conversation_counts_test_cases()
|
||||
* @param array $conversationconfigs Conversations to create
|
||||
* @param int $deletemessagesuser The user who is deleting the messages
|
||||
* @param array $deletemessages The list of messages to delete (by index)
|
||||
@@ -5596,7 +5596,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test the get_unread_conversation_counts() function.
|
||||
*
|
||||
* @dataProvider test_get_conversation_counts_test_cases()
|
||||
* @dataProvider get_conversation_counts_test_cases
|
||||
* @param array $conversationconfigs Conversations to create
|
||||
* @param int $deletemessagesuser The user who is deleting the messages
|
||||
* @param array $deletemessages The list of messages to delete (by index)
|
||||
|
||||
@@ -875,7 +875,7 @@ class locallib_test extends \advanced_testcase {
|
||||
* We only test combinations of plugins here. Individual plugins are tested
|
||||
* in their respective test files.
|
||||
*
|
||||
* @dataProvider test_new_submission_empty_testcases
|
||||
* @dataProvider new_submission_empty_testcases
|
||||
* @param string $data The file submission data
|
||||
* @param bool $expected The expected return value
|
||||
*/
|
||||
@@ -915,7 +915,7 @@ class locallib_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array of testcases
|
||||
*/
|
||||
public function test_new_submission_empty_testcases() {
|
||||
public function new_submission_empty_testcases() {
|
||||
return [
|
||||
'With file and onlinetext' => [
|
||||
[
|
||||
|
||||
@@ -115,7 +115,7 @@ class entities_discussion_test extends \advanced_testcase {
|
||||
* Test the display period settings for discussions.
|
||||
* This covers each individual date function as well as the combination of the 2.
|
||||
*
|
||||
* @dataProvider test_diplay_period_options_provider
|
||||
* @dataProvider diplay_period_options_provider
|
||||
* @param string $testdescription A basic description of the base assertions.
|
||||
* @param int $startoffset Start time offset with current time in seconds.
|
||||
* @param int $endoffset End time offset with current time in seconds.
|
||||
@@ -159,7 +159,7 @@ class entities_discussion_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array start/end time offsets and the expected results.
|
||||
*/
|
||||
public function test_diplay_period_options_provider() {
|
||||
public function diplay_period_options_provider() {
|
||||
return array(
|
||||
["No dates set", 0, 0, true, false, true],
|
||||
["Only started date in the future", 100, 0, false, false, false],
|
||||
|
||||
@@ -260,7 +260,7 @@ class locallib_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function test_get_last_attempt_dataprovider() {
|
||||
public function get_last_attempt_dataprovider() {
|
||||
return [
|
||||
[0, [(object)['id' => 1], (object)['id' => 2], (object)['id' => 3]], (object)['id' => 3]],
|
||||
[1, [(object)['id' => 1], (object)['id' => 2], (object)['id' => 3]], (object)['id' => 1]],
|
||||
@@ -273,7 +273,7 @@ class locallib_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the get_last_attempt() method.
|
||||
*
|
||||
* @dataProvider test_get_last_attempt_dataprovider
|
||||
* @dataProvider get_last_attempt_dataprovider
|
||||
* @param int $maxattempts Lesson setting.
|
||||
* @param array $attempts The list of student attempts.
|
||||
* @param object $expected Expected result.
|
||||
|
||||
Reference in New Issue
Block a user