mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Merge branch 'MDL-76859-401' of https://github.com/sarjona/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
bc34e3fef3
@ -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"
|
||||
|
@ -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(
|
||||
|
@ -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"
|
||||
|
@ -60,8 +60,10 @@
|
||||
</div>
|
||||
{{#js}}
|
||||
(function() {
|
||||
H5PEmbedCommunicator.send('resize', {
|
||||
scrollHeight: document.body.scrollHeight
|
||||
});
|
||||
if (typeof H5PEmbedCommunicator !== 'undefined') {
|
||||
H5PEmbedCommunicator.send('resize', {
|
||||
scrollHeight: document.body.scrollHeight
|
||||
});
|
||||
}
|
||||
})();
|
||||
{{/js}}
|
||||
|
@ -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,
|
||||
|
@ -605,7 +605,7 @@ class file_storage_test extends \advanced_testcase {
|
||||
true,
|
||||
],
|
||||
'Icon not included' => [
|
||||
'greeting-card-887.h5p',
|
||||
'greeting-card.h5p',
|
||||
false,
|
||||
],
|
||||
];
|
||||
|
BIN
h5p/tests/fixtures/greeting-card-887.h5p
vendored
BIN
h5p/tests/fixtures/greeting-card-887.h5p
vendored
Binary file not shown.
BIN
h5p/tests/fixtures/greeting-card.h5p
vendored
Normal file
BIN
h5p/tests/fixtures/greeting-card.h5p
vendored
Normal file
Binary file not shown.
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
@ -70,7 +70,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();
|
||||
|
@ -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 |
|
||||
|
@ -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');
|
||||
|
@ -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"
|
||||
|
@ -72,12 +72,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;
|
||||
|
||||
|
@ -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 |
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user