diff --git a/contentbank/tests/behat/view_preferences.feature b/contentbank/tests/behat/view_preferences.feature index ab92d455578..b8d5b3d193c 100644 --- a/contentbank/tests/behat/view_preferences.feature +++ b/contentbank/tests/behat/view_preferences.feature @@ -11,7 +11,7 @@ Feature: Store the content bank view preference And I log in as "admin" And I follow "Manage private files..." And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager - And I upload "h5p/tests/fixtures/greeting-card-887.h5p" file to "Files" filemanager + And I upload "h5p/tests/fixtures/greeting-card.h5p" file to "Files" filemanager And I click on "Save changes" "button" And I am on site homepage And I turn editing mode on @@ -35,7 +35,7 @@ Feature: Store the content bank view preference And I click on "Upload" "link" And I click on "Choose a file..." "button" And I click on "Private files" "link" in the ".fp-repo-area" "css_element" - And I click on "greeting-card-887.h5p" "link" + And I click on "greeting-card.h5p" "link" And I set the field "Save as" to "greetingcard.h5p" And I click on "Select this file" "button" And I click on "Save changes" "button" diff --git a/contentbank/tests/contentbank_test.php b/contentbank/tests/contentbank_test.php index 485717fcaf9..997b8540181 100644 --- a/contentbank/tests/contentbank_test.php +++ b/contentbank/tests/contentbank_test.php @@ -364,7 +364,7 @@ class contentbank_test extends advanced_testcase { $this->resetAfterTest(); $this->setAdminUser(); $systemcontext = \context_system::instance(); - $name = 'greeting-card-887.h5p'; + $name = 'greeting-card.h5p'; // Create a dummy H5P file. $dummyh5p = array( diff --git a/filter/displayh5p/tests/behat/inline_editing_content.feature b/filter/displayh5p/tests/behat/inline_editing_content.feature index 49afc17e205..f9a26526b0c 100644 --- a/filter/displayh5p/tests/behat/inline_editing_content.feature +++ b/filter/displayh5p/tests/behat/inline_editing_content.feature @@ -20,7 +20,7 @@ Feature: Inline editing H5P content anywhere | student1 | C1 | student | And the following "contentbank content" exist: | contextlevel | reference | contenttype | user | contentname | filepath | - | Course | C1 | contenttype_h5p | admin | Greeting card | /h5p/tests/fixtures/greeting-card-887.h5p | + | Course | C1 | contenttype_h5p | admin | Greeting card | /h5p/tests/fixtures/greeting-card.h5p | And the following "activities" exist: | activity | name | intro | introformat | course | content | contentformat | idnumber | | page | PageName1 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 | @@ -42,7 +42,7 @@ Feature: Inline editing H5P content anywhere And I log in as "teacher1" # Upload the H5P to private user files. And I follow "Manage private files..." - And I upload "h5p/tests/fixtures/greeting-card-887.h5p" file to "Files" filemanager + And I upload "h5p/tests/fixtures/greeting-card.h5p" file to "Files" filemanager And I click on "Save changes" "button" # Add H5P content to the page. And I am on "Course 1" course homepage @@ -51,7 +51,7 @@ Feature: Inline editing H5P content anywhere And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue" And I select "Private files" repository in file picker - And I click on "greeting-card-887.h5p" "file" in repository content area + And I click on "greeting-card.h5p" "file" in repository content area And I click on "Link to the file" "radio" And I click on "Select this file" "button" And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue" diff --git a/h5p/templates/h5perror.mustache b/h5p/templates/h5perror.mustache index 78f20d2fb4a..8378b0fff98 100644 --- a/h5p/templates/h5perror.mustache +++ b/h5p/templates/h5perror.mustache @@ -60,8 +60,10 @@ {{#js}} (function() { - H5PEmbedCommunicator.send('resize', { - scrollHeight: document.body.scrollHeight - }); + if (typeof H5PEmbedCommunicator !== 'undefined') { + H5PEmbedCommunicator.send('resize', { + scrollHeight: document.body.scrollHeight + }); + } })(); {{/js}} diff --git a/h5p/tests/api_test.php b/h5p/tests/api_test.php index 007600021b4..b3fe6c3322d 100644 --- a/h5p/tests/api_test.php +++ b/h5p/tests/api_test.php @@ -349,7 +349,7 @@ class api_test extends \advanced_testcase { $syscontext = \context_system::instance(); // Create the original file. - $filename = 'greeting-card-887.h5p'; + $filename = 'greeting-card.h5p'; $path = __DIR__ . '/fixtures/' . $filename; $originalfile = helper::create_fake_stored_file_from_path($path); $originalfilerecord = [ @@ -491,7 +491,7 @@ class api_test extends \advanced_testcase { } // Create the file. - $filename = 'greeting-card-887.h5p'; + $filename = 'greeting-card.h5p'; $path = __DIR__ . '/fixtures/' . $filename; if ($filecomponent === 'contentbank') { $generator = $this->getDataGenerator()->get_plugin_generator('core_contentbank'); @@ -1197,33 +1197,33 @@ class api_test extends \advanced_testcase { public function is_valid_package_provider(): array { return [ 'Valid H5P file (as admin)' => [ - 'filename' => '/fixtures/greeting-card-887.h5p', + 'filename' => '/fixtures/greeting-card.h5p', 'expected' => true, 'isadmin' => true, ], 'Valid H5P file (as user) without library update and checking content' => [ - 'filename' => '/fixtures/greeting-card-887.h5p', + 'filename' => '/fixtures/greeting-card.h5p', 'expected' => false, // Libraries are missing and user hasn't the right permissions to upload them. 'isadmin' => false, 'onlyupdatelibs' => false, 'skipcontent' => false, ], 'Valid H5P file (as user) with library update and checking content' => [ - 'filename' => '/fixtures/greeting-card-887.h5p', + 'filename' => '/fixtures/greeting-card.h5p', 'expected' => false, // Libraries are missing and user hasn't the right permissions to upload them. 'isadmin' => false, 'onlyupdatelibs' => true, 'skipcontent' => false, ], 'Valid H5P file (as user) without library update and skipping content' => [ - 'filename' => '/fixtures/greeting-card-887.h5p', + 'filename' => '/fixtures/greeting-card.h5p', 'expected' => true, // Content check is skipped so the package will be considered valid. 'isadmin' => false, 'onlyupdatelibs' => false, 'skipcontent' => true, ], 'Valid H5P file (as user) with library update and skipping content' => [ - 'filename' => '/fixtures/greeting-card-887.h5p', + 'filename' => '/fixtures/greeting-card.h5p', 'expected' => true, // Content check is skipped so the package will be considered valid. 'isadmin' => false, 'onlyupdatelibs' => true, diff --git a/h5p/tests/file_storage_test.php b/h5p/tests/file_storage_test.php index e81e804facf..fa61ed79b3e 100644 --- a/h5p/tests/file_storage_test.php +++ b/h5p/tests/file_storage_test.php @@ -605,7 +605,7 @@ class file_storage_test extends \advanced_testcase { true, ], 'Icon not included' => [ - 'greeting-card-887.h5p', + 'greeting-card.h5p', false, ], ]; diff --git a/h5p/tests/fixtures/greeting-card-887.h5p b/h5p/tests/fixtures/greeting-card-887.h5p deleted file mode 100644 index 40d3093ed4e..00000000000 Binary files a/h5p/tests/fixtures/greeting-card-887.h5p and /dev/null differ diff --git a/h5p/tests/fixtures/greeting-card.h5p b/h5p/tests/fixtures/greeting-card.h5p new file mode 100644 index 00000000000..68e7880cc90 Binary files /dev/null and b/h5p/tests/fixtures/greeting-card.h5p differ diff --git a/h5p/tests/helper_test.php b/h5p/tests/helper_test.php index 390ad685b9b..1f75f049aff 100644 --- a/h5p/tests/helper_test.php +++ b/h5p/tests/helper_test.php @@ -137,7 +137,7 @@ class helper_test extends \advanced_testcase { $this->setUser($user); // This is a valid .H5P file. - $path = __DIR__ . '/fixtures/greeting-card-887.h5p'; + $path = __DIR__ . '/fixtures/greeting-card.h5p'; $file = helper::create_fake_stored_file_from_path($path, (int)$user->id); $factory->get_framework()->set_file($file); @@ -173,7 +173,7 @@ class helper_test extends \advanced_testcase { $this->setUser($user); // This is a valid .H5P file. - $path = __DIR__ . '/fixtures/greeting-card-887.h5p'; + $path = __DIR__ . '/fixtures/greeting-card.h5p'; $file = helper::create_fake_stored_file_from_path($path, (int)$user->id); $factory->get_framework()->set_file($file); @@ -247,7 +247,7 @@ class helper_test extends \advanced_testcase { $admin = get_admin(); // Prepare a valid .H5P file. - $path = __DIR__ . '/fixtures/greeting-card-887.h5p'; + $path = __DIR__ . '/fixtures/greeting-card.h5p'; // Files created by users can't be deployed. $file = helper::create_fake_stored_file_from_path($path, (int)$user->id); @@ -275,7 +275,7 @@ class helper_test extends \advanced_testcase { $admin = get_admin(); // Prepare a valid .H5P file. - $path = __DIR__ . '/fixtures/greeting-card-887.h5p'; + $path = __DIR__ . '/fixtures/greeting-card.h5p'; // Libraries can't be updated when the file has been created by users. $file = helper::create_fake_stored_file_from_path($path, (int)$user->id); diff --git a/lib/tests/event/contentbank_content_uploaded_test.php b/lib/tests/event/contentbank_content_uploaded_test.php index 1f7af49ca2e..2aa131f1327 100644 --- a/lib/tests/event/contentbank_content_uploaded_test.php +++ b/lib/tests/event/contentbank_content_uploaded_test.php @@ -69,7 +69,7 @@ class contentbank_content_uploaded_test extends \advanced_testcase { 'filepath' => '/', 'filename' => 'dummy_h5p.h5p' ); - $path = $CFG->dirroot . '/h5p/tests/fixtures/greeting-card-887.h5p'; + $path = $CFG->dirroot . '/h5p/tests/fixtures/greeting-card.h5p'; $dummyh5pfile = \core_h5p\helper::create_fake_stored_file_from_path($path); // Trigger and capture the event when creating content from a file. diff --git a/lib/tests/h5p_clean_orphaned_records_task_test.php b/lib/tests/h5p_clean_orphaned_records_task_test.php index 48992e9b168..59420aaa56d 100644 --- a/lib/tests/h5p_clean_orphaned_records_task_test.php +++ b/lib/tests/h5p_clean_orphaned_records_task_test.php @@ -39,13 +39,13 @@ class h5p_clean_orphaned_records_task_test extends advanced_testcase { $course = $this->getDataGenerator()->create_course(); $params = [ 'course' => $course->id, - 'packagefilepath' => $CFG->dirroot.'/h5p/tests/fixtures/greeting-card-887.h5p', + 'packagefilepath' => $CFG->dirroot.'/h5p/tests/fixtures/greeting-card.h5p', 'introformat' => 1 ]; // Create h5pactivity. $activity = $this->getDataGenerator()->create_module('h5pactivity', $params); - $activity->filename = 'greeting-card-887.h5p'; + $activity->filename = 'greeting-card.h5p'; $context = context_module::instance($activity->cmid); // Create a fake deploy H5P file. @@ -71,7 +71,7 @@ class h5p_clean_orphaned_records_task_test extends advanced_testcase { AND filearea = 'content' AND component = 'core_h5p'"; $orphanedfiles = $DB->get_records_sql($orphanedfilessql, ['h5pid' => $h5pid]); - $this->assertEquals(3, count($orphanedfiles)); + $this->assertEquals(2, count($orphanedfiles)); // Execute task. $task = new \core\task\h5p_clean_orphaned_records_task(); diff --git a/mod/forum/tests/behat/h5p_inline_editing_content.feature b/mod/forum/tests/behat/h5p_inline_editing_content.feature index 759861df7ce..28bffa4ea20 100644 --- a/mod/forum/tests/behat/h5p_inline_editing_content.feature +++ b/mod/forum/tests/behat/h5p_inline_editing_content.feature @@ -20,7 +20,7 @@ Feature: Inline editing H5P content in mod_forum | student1 | C1 | student | And the following "contentbank content" exist: | contextlevel | reference | contenttype | user | contentname | filepath | - | Course | C1 | contenttype_h5p | admin | Greeting card | /h5p/tests/fixtures/greeting-card-887.h5p | + | Course | C1 | contenttype_h5p | admin | Greeting card | /h5p/tests/fixtures/greeting-card.h5p | And the following "activities" exist: | activity | name | intro | introformat | course | content | contentformat | idnumber | | forum | ForumName1 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 | diff --git a/mod/forum/tests/h5p/canedit_test.php b/mod/forum/tests/h5p/canedit_test.php index 17139438844..1973bf8eeb6 100644 --- a/mod/forum/tests/h5p/canedit_test.php +++ b/mod/forum/tests/h5p/canedit_test.php @@ -85,7 +85,7 @@ class canedit_test extends \advanced_testcase { } // Create the file. - $filename = 'greeting-card-887.h5p'; + $filename = 'greeting-card.h5p'; $path = __DIR__ . '/../../../../h5p/tests/fixtures/' . $filename; if ($filecomponent === 'contentbank') { $generator = $this->getDataGenerator()->get_plugin_generator('core_contentbank'); diff --git a/mod/h5pactivity/tests/behat/inline_editing_content.feature b/mod/h5pactivity/tests/behat/inline_editing_content.feature index 4ebd54e617a..c1878204215 100644 --- a/mod/h5pactivity/tests/behat/inline_editing_content.feature +++ b/mod/h5pactivity/tests/behat/inline_editing_content.feature @@ -29,7 +29,7 @@ Feature: Inline editing H5P content Scenario: Add H5P activity using link to content bank file Given the following "contentbank content" exist: | contextlevel | reference | contenttype | user | contentname | filepath | - | Course | C1 | contenttype_h5p | teacher1 | Greeting card | /h5p/tests/fixtures/greeting-card-887.h5p | + | Course | C1 | contenttype_h5p | teacher1 | Greeting card | /h5p/tests/fixtures/greeting-card.h5p | And I log in as "admin" # Add the navigation block. And I am on "Course 1" course homepage with editing mode on @@ -91,7 +91,7 @@ Feature: Inline editing H5P content Scenario: Add H5P activity using copy to content bank file Given the following "contentbank content" exist: | contextlevel | reference | contenttype | user | contentname | filepath | - | Course | C1 | contenttype_h5p | admin | Greeting card | /h5p/tests/fixtures/greeting-card-887.h5p | + | Course | C1 | contenttype_h5p | admin | Greeting card | /h5p/tests/fixtures/greeting-card.h5p | And I log in as "admin" # Add the navigation block. And I am on "Course 1" course homepage with editing mode on @@ -154,7 +154,7 @@ Feature: Inline editing H5P content Given I log in as "teacher1" # Upload the H5P to private user files. And I follow "Manage private files..." - And I upload "h5p/tests/fixtures/greeting-card-887.h5p" file to "Files" filemanager + And I upload "h5p/tests/fixtures/greeting-card.h5p" file to "Files" filemanager And I click on "Save changes" "button" # Create an H5P activity with a private user file. And I am on "Course 1" course homepage with editing mode on @@ -164,7 +164,7 @@ Feature: Inline editing H5P content | Description | Description | And I click on "Add..." "button" in the "Package file" "form_row" And I select "Private files" repository in file picker - And I click on "greeting-card-887.h5p" "file" in repository content area + And I click on "greeting-card.h5p" "file" in repository content area And I click on "Link to the file" "radio" And I click on "Select this file" "button" And I click on "Save and display" "button" diff --git a/mod/h5pactivity/tests/external/get_h5pactivities_by_courses_test.php b/mod/h5pactivity/tests/external/get_h5pactivities_by_courses_test.php index 90cb9fc9aed..17e80c82bfc 100644 --- a/mod/h5pactivity/tests/external/get_h5pactivities_by_courses_test.php +++ b/mod/h5pactivity/tests/external/get_h5pactivities_by_courses_test.php @@ -71,12 +71,12 @@ class get_h5pactivities_by_courses_test extends externallib_advanced_testcase { $params = [ 'course' => $course1->id, - 'packagefilepath' => $CFG->dirroot.'/h5p/tests/fixtures/greeting-card-887.h5p', + 'packagefilepath' => $CFG->dirroot.'/h5p/tests/fixtures/greeting-card.h5p', 'introformat' => 1 ]; $activities[] = $this->getDataGenerator()->create_module('h5pactivity', $params); // Add filename and contextid to make easier the asserts. - $activities[1]->filename = 'greeting-card-887.h5p'; + $activities[1]->filename = 'greeting-card.h5p'; $context = context_module::instance($activities[1]->cmid); $activities[1]->contextid = $context->id; diff --git a/repository/contentbank/tests/behat/search_content.feature b/repository/contentbank/tests/behat/search_content.feature index bd5882e4415..fc253073952 100644 --- a/repository/contentbank/tests/behat/search_content.feature +++ b/repository/contentbank/tests/behat/search_content.feature @@ -23,7 +23,7 @@ Feature: Search content bank files using the content bank files repository | Course | C2 | contenttype_h5p | admin | coursecontent2.h5p | /h5p/tests/fixtures/find-the-words.h5p | | Category | CAT1 | contenttype_h5p | admin | categorycontent1.h5p | /h5p/tests/fixtures/ipsums.h5p | | Category | CAT2 | contenttype_h5p | admin | categorycontent2.h5p | /h5p/tests/fixtures/multiple-choice-2-6.h5p | - | System | | contenttype_h5p | admin | systemcontent.h5p | /h5p/tests/fixtures/greeting-card-887.h5p | + | System | | contenttype_h5p | admin | systemcontent.h5p | /h5p/tests/fixtures/greeting-card.h5p | And the following "activities" exist: | activity | name | intro | introformat | course | idnumber | | folder | Folder | FolderDesc | 1 | C1 | folder | diff --git a/repository/contentbank/tests/behat/select_content.feature b/repository/contentbank/tests/behat/select_content.feature index c484e056235..f62718fe1ba 100644 --- a/repository/contentbank/tests/behat/select_content.feature +++ b/repository/contentbank/tests/behat/select_content.feature @@ -24,7 +24,7 @@ Feature: Select content bank files using the content bank files repository | contextlevel | reference | contenttype | user | contentname | filepath | | Course | mscC1 | contenttype_h5p | admin | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p | | Course | mscC2 | contenttype_h5p | admin | find-the-words.h5p | /h5p/tests/fixtures/find-the-words.h5p | - | Course | subcat1C1 | contenttype_h5p | admin | greeting-card-887.h5p | /h5p/tests/fixtures/greeting-card-887.h5p | + | Course | subcat1C1 | contenttype_h5p | admin | greeting-card.h5p | /h5p/tests/fixtures/greeting-card.h5p | | Category | CAT1 | contenttype_h5p | admin | ipsums.h5p | /h5p/tests/fixtures/ipsums.h5p | | Category | SUBCAT1 | contenttype_h5p | admin | multiple-choice-2-6.h5p | /h5p/tests/fixtures/multiple-choice-2-6.h5p | | System | | contenttype_h5p | admin | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p | @@ -76,7 +76,7 @@ Feature: Select content bank files using the content bank files repository And I click on "SubCategory1Course1" "folder" in repository content area And I should see "System > Category1 > SubCategory1 > SubCategory1Course1" breadcrumb navigation in repository And I should see "1" elements in repository content area - And I should see "greeting-card-887.h5p" "file" in repository content area + And I should see "greeting-card.h5p" "file" in repository content area Scenario: Admin can select and re-use content bank files using the content bank repository Given I am on the Folder "Folder activity" page logged in as admin