Update from 1.11.x

pull/2944/head
Julio Montoya 6 years ago
parent 8690b88f0a
commit 14582721a8
  1. BIN
      public/img/icons/22/bar_progress.png
  2. BIN
      public/img/icons/22/icon_check.png
  3. BIN
      public/img/icons/22/icon_error.png
  4. 49
      tests/behat/features/bootstrap/FeatureContext.php
  5. 12
      tests/behat/features/course_user_registration.feature
  6. 320
      tests/behat/features/toolGroup.feature
  7. 2
      tests/behat/features/toolLp.feature
  8. 2
      tests/scripts/fix_course_spent_time.php
  9. 4
      tests/scripts/fix_duplicate_settings.php
  10. 18
      tests/scripts/fix_exercise_score_in_lp.php
  11. 2
      tests/scripts/fix_lp_id_to_iid.php
  12. 2
      tests/scripts/fix_lp_items_not_found.php
  13. 2
      tests/scripts/users_no_course.php

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

@ -71,7 +71,7 @@ class FeatureContext extends MinkContext
public function courseExists($argument)
{
$this->iAmAPlatformAdministrator();
$this->visit('/main/admin/course_list.php?keyword=' . $argument);
$this->visit('/main/admin/course_list.php?keyword='.$argument);
$this->assertPageContainsText($argument);
}
@ -81,7 +81,7 @@ class FeatureContext extends MinkContext
public function courseIsDeleted($argument)
{
$this->iAmAPlatformAdministrator();
$this->visit('/main/admin/course_list.php?keyword=' . $argument);
$this->visit('/main/admin/course_list.php?keyword='.$argument);
$this->clickLink('Delete');
}
@ -136,16 +136,16 @@ class FeatureContext extends MinkContext
$sendInvitationURL = '/main/inc/ajax/message.ajax.php?'.
http_build_query(
[
'a' => 'send_invitation',
'user_id' => $friendId,
'a' => 'send_invitation',
'user_id' => $friendId,
'content' => 'Add me',
]
);
$acceptInvitationURL = '/main/inc/ajax/social.ajax.php?'.
http_build_query(
[
'a' => 'add_friend',
'friend_id' => $adminId,
'a' => 'add_friend',
'friend_id' => $adminId,
'is_my_friend' => 'friend',
]
);
@ -166,14 +166,14 @@ class FeatureContext extends MinkContext
$this->fillFields(
new TableNode(
[
['title', 'Password Protected'],
['visual_code', $code],
['title', 'Password Protected'],
['visual_code', $code],
['visibility', 3],
]
)
);
$this->pressButton('submit');
$this->visit('/main/course_info/infocours.php?cidReq=' . $code);
$this->visit('/main/course_info/infocours.php?cidReq='.$code);
$this->assertPageContainsText('Course registration password');
$this->fillField('course_registration_password', $password);
$this->pressButton('submit_save');
@ -194,7 +194,7 @@ class FeatureContext extends MinkContext
*/
public function iInviteAFriendToASocialGroup($friendId, $groupId)
{
$this->visit('/main/social/group_invitation.php?id=' . $groupId);
$this->visit('/main/social/group_invitation.php?id='.$groupId);
$this->fillField('invitation[]', $friendId);
$this->pressButton('submit');
}
@ -233,7 +233,7 @@ class FeatureContext extends MinkContext
*/
public function iAmOnSocialGroupMembersPageWithId($groupId)
{
$this->visit('/main/social/group_view.php?id=' . $groupId);
$this->visit('/main/social/group_view.php?id='.$groupId);
}
/**
@ -244,8 +244,8 @@ class FeatureContext extends MinkContext
$this->visit(
'/main/social/group_members.php?'.http_build_query(
[
'id' => $groupId,
'u' => $friendId,
'id' => $groupId,
'u' => $friendId,
'action' => 'delete',
]
)
@ -470,6 +470,29 @@ class FeatureContext extends MinkContext
return false;
}
/**
* @Then /^I save current URL with name "([^"]*)"$/
*/
public function saveUrlWithName($name)
{
$url = $this->getSession()->getCurrentUrl();
$this->getSession()->setCookie($name, $url);
}
/**
* @Then /^I visit URL saved with name "([^"]*)"$/
*/
public function visitSavedUrlWithName($name)
{
$url = $this->getSession()->getCookie($name);
echo $url;
if (empty($url)) {
throw new Exception("Url with name: $name not found");
}
$this->visit($url);
}
/**
* @Given /^I am a student subscribed to session "([^"]*)"$/
*

@ -21,3 +21,15 @@ Feature: Subscribe users to the course
Then I should see "Andrea"
Then I follow "Register"
Then I should see "User Andrea Costea (acostea) has been registered to course TEMP"
Scenario: Subscribe "fapple" as student to the course "TEMP" (leave it subscribed for further tests)
Given I am on "/main/user/subscribe_user.php?keyword=fapple&type=5&cidReq=TEMP"
Then I should see "Fiona"
Then I follow "Register"
Then I should see "User Fiona Apple Maggart (fapple) has been registered to course TEMP"
Scenario: Subscribe "amann" again as student to the course "TEMP" (leave it subscribed for further tests)
Given I am on "/main/user/subscribe_user.php?keyword=amann&type=5&cidReq=TEMP"
Then I should see "Aimee"
Then I follow "Register"
Then I should see "User Aimee Mann (amann) has been registered to course TEMP"

@ -6,24 +6,41 @@ Feature: Group tool
Given I am a platform administrator
And I am on course "TEMP" homepage
Scenario: Delete default category
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
Then I should see "Default groups"
Then I follow "Delete"
Then I confirm the popup
Then I should see "The category has been deleted"
Scenario: Create a group directory
Given I am on "/main/group/group_category.php?cidReq=TEMP&id_session=0&action=add_category"
When I fill in the following:
| title | Group category 1 |
| title | Group category 1 |
And I press "group_category_submit"
Then I should see "Category created"
Scenario: Create a group
Scenario: Create 4 groups
Given I am on "/main/group/group_creation.php?cidReq=TEMP&id_session=0"
When I fill in the following:
| number_of_groups | 1 |
| number_of_groups | 5 |
And I press "submit"
Then I should see "New groups creation"
When I fill in the following:
| group_0_places | 1 |
| group_1_places | 1 |
| group_2_places | 1 |
| group_3_places | 1 |
| group_4_places | 2 |
And I fill in select bootstrap static by text "#category_0" select "Group category 1"
And I fill in select bootstrap static by text "#category_1" select "Group category 1"
And I fill in select bootstrap static by text "#category_2" select "Group category 1"
And I fill in select bootstrap static by text "#category_3" select "Group category 1"
And I fill in select bootstrap static by text "#category_4" select "Group category 1"
And I press "submit"
Then I should see "group(s) has (have) been added"
Scenario: Create document folder in group
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0001"
@ -90,3 +107,300 @@ Feature: Group tool
Then wait for the page to be loaded
Then I should see "Are you sure to delete"
Then I follow "delete_item"
Scenario: Add fapple to the Group 0001
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0001"
Then I should see "Group 0001"
Then I follow "Edit this group"
Then I should see "Group members"
Then wait for the page to be loaded
Then I follow "group_members_tab"
Then I select "Fiona Apple Maggart (fapple)" from "group_members"
Then I press "group_members_rightSelected"
Then I press "Save settings"
And wait for the page to be loaded
Then I should see "Group settings modified"
Then I follow "Group 0001"
Then I should see "Fiona"
Scenario: Add fapple to the Group 0003 not allowed because group category allows 1 user per group
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0003"
Then I should see "Group 0003"
Then I follow "Edit this group"
Then I should see "Group members"
Then wait for the page to be loaded
Then I follow "group_members_tab"
Then I select "Fiona Apple Maggart (fapple)" from "group_members"
Then I press "group_members_rightSelected"
Then I press "Save settings"
And wait for the page to be loaded
Then I should see "Group settings modified"
Then I follow "Group 0003"
Then I should not see "Fiona"
# Group category overwrites all other groups settings.
Scenario: Change Group category to allow multiple inscription of the user
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Edit this category"
Then I should see "Edit group category: Group category 1"
Then I fill in select bootstrap static by text "#groups_per_user" select "10"
Then I press "Edit"
Then I should see "Group settings have been modified"
Scenario: Change Group 0003 settings to make announcements private
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0003"
Then I should see "Group 0003"
Then I follow "Edit this group"
Then I check the "announcements_state" radio button with "2" value
Then I press "Save settings"
Then I should see "Group settings modified"
Scenario: Change Group 0004 settings to make it private
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0004"
Then I should see "Group 0004"
Then I follow "Edit this group"
Then I check the "announcements_state" radio button with "2" value
Then I press "Save settings"
Then I should see "Group settings modified"
Scenario: Change Group 0005 settings to make announcements private between users
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0005"
Then I should see "Group 0005"
Then I follow "Edit this group"
Then I check the "announcements_state" radio button with "3" value
Then I press "Save settings"
Then I should see "Group settings modified"
Scenario: Add fapple and acostea to Group 0005
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0005"
Then I should see "Group 0005"
Then I follow "Edit this group"
Then I should see "Group members"
Then wait for the page to be loaded
Then I follow "group_members_tab"
Then I additionally select "Fiona Apple Maggart (fapple)" from "group_members"
Then I additionally select "Andrea Costea (acostea)" from "group_members"
Then I press "group_members_rightSelected"
Then I press "Save settings"
And wait for the page to be loaded
Then I should see "Group settings modified"
Then I follow "Group 0005"
Then I should see "Fiona"
Then I should see "Andrea"
Scenario: Add fapple to the Group 0003
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0003"
Then I should see "Group 0003"
Then I follow "Edit this group"
Then I should see "Group members"
Then wait for the page to be loaded
Then I follow "group_members_tab"
Then I select "Fiona Apple Maggart (fapple)" from "group_members"
Then I press "group_members_rightSelected"
Then I press "Save settings"
And wait for the page to be loaded
Then I should see "Group settings modified"
Then I follow "Group 0003"
Then I should see "Fiona"
Scenario: Add acostea to the Group 0002
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0002"
Then I should see "Group 0002"
Then I follow "Edit this group"
Then I should see "Group members"
Then wait for the page to be loaded
Then I follow "group_members_tab"
Then I select "Andrea Costea (acostea)" from "group_members"
Then I press "group_members_rightSelected"
Then I press "Save settings"
And wait for the page to be loaded
Then I should see "Group settings modified"
Then I follow "Group 0002"
Then I should see "Andrea"
Scenario: Create an announcement for everybody inside Group 0001
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0001"
Then I should see "Group 0001"
And I follow "Announcements"
Then I should see "Announcements"
Then I follow "Add an announcement"
Then I should see "Add an announcement"
Then wait for the page to be loaded
Then I fill in the following:
| title | Announcement for all users inside Group 0001 |
And I fill in ckeditor field "content" with "Announcement description in Group 0001"
Then I follow "announcement_preview"
And wait for the page to be loaded
Then I should see "Announcement will be sent to"
Then I press "submit"
Then I should see "Announcement has been added"
Scenario: Create an announcement for fapple inside Group 0001
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0001"
Then I should see "Group 0001"
And I follow "Announcements"
Then I should see "Announcements"
Then I follow "Add an announcement"
Then I should see "Add an announcement"
Then wait for the page to be loaded
Then I press "choose_recipients"
Then I select "Fiona Apple" from "users"
Then I press "users_rightSelected"
Then I fill in the following:
| title | Announcement for user fapple inside Group 0001 |
And I fill in ckeditor field "content" with "Announcement description for user fapple inside Group 0001"
Then I follow "announcement_preview"
And wait for the page to be loaded
Then I should see "Announcement will be sent to"
Then I press "submit"
Then I should see "Announcement has been added"
Scenario: Create an announcement for everybody inside Group 0003 (private)
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0003"
Then I should see "Group 0003"
And I follow "Announcements"
Then I should see "Announcements"
Then I follow "Add an announcement"
Then I should see "Add an announcement"
Then wait for the page to be loaded
Then I fill in the following:
| title | Announcement for all users inside Group 0003 |
And I fill in ckeditor field "content" with "Announcement description in Group 0003"
Then I follow "announcement_preview"
And wait for the page to be loaded
Then I should see "Announcement will be sent to"
Then I press "submit"
Then I should see "Announcement has been added"
Scenario: Create an announcement for fapple inside Group 0003
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0003"
Then I should see "Group 0003"
And I follow "Announcements"
Then I should see "Announcements"
Then I follow "Add an announcement"
Then I should see "Add an announcement"
Then wait for the page to be loaded
Then I press "choose_recipients"
Then I select "Fiona Apple" from "users"
Then I press "users_rightSelected"
Then I fill in the following:
| title | Announcement for user fapple inside Group 0003 |
And I fill in ckeditor field "content" with "Announcement description for user fapple inside Group 0003"
Then I follow "announcement_preview"
And wait for the page to be loaded
Then I should see "Announcement will be sent to"
Then I press "submit"
Then I should see "Announcement has been added"
Scenario: Create an announcement as acostea and send only to fapple
Given I am logged as "acostea"
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0005"
Then I should see "Group 0005"
And I follow "Announcements"
Then I should see "Announcements"
Then I follow "Add an announcement"
Then I should see "Add an announcement"
Then wait for the page to be loaded
Then I press "choose_recipients"
Then I select "Fiona Apple Maggart" from "users"
Then I press "users_rightSelected"
Then I fill in the following:
| title | Announcement only for fapple Group 0005 |
And I fill in ckeditor field "content" with "Announcement description only for fapple Group 0005"
Then I follow "announcement_preview"
And wait for the page to be loaded
Then I should see "Announcement will be sent to"
Then I press "submit"
Then I should see "Announcement has been added"
Scenario: Check fapple/acostea access of announcements
Given I am logged as "fapple"
And I am on course "TEMP" homepage
And I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0001"
Then I should see "Group 0001"
Then I follow "Announcements"
And wait for the page to be loaded
Then I should see "Announcement for all users inside Group 0001"
Then I should see "Announcement for user fapple inside Group 0001"
Then I follow "Announcement for user fapple inside Group 0001 Group"
Then I should see "Announcement description for user fapple inside Group 0001"
Then I save current URL with name "announcement_for_user_fapple_group_0001_public"
Then I move backward one page
Then wait for the page to be loaded
Then I should see "Announcement for all users inside Group 0001"
Then I follow "Announcement for all users inside Group 0001"
Then I save current URL with name "announcement_for_all_users_group_0001_public"
Then I should see "Announcement description in Group 0001"
And I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0003"
Then I should see "Group 0003"
Then I follow "Announcements"
And wait for the page to be loaded
Then I should see "Announcement for all users inside Group 0003"
Then I should see "Announcement for user fapple inside Group 0003"
Then I follow "Announcement for user fapple inside Group 0003 Group"
Then I should see "Announcement description for user fapple inside Group 0003"
Then I save current URL with name "announcement_for_user_fapple_group_0003_private"
Then I move backward one page
Then wait for the page to be loaded
Then I should see "Announcement for all users inside Group 0003"
Then I follow "Announcement for all users inside Group 0003"
Then I should see "Announcement description in Group 0003"
Then I save current URL with name "announcement_for_all_users_group_0003_private"
And I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0005"
Then I should see "Group 0005"
Then I follow "Announcements"
And wait for the page to be loaded
Then I should see "Announcement only for fapple Group 0005"
Then I follow "Announcement only for fapple Group 0005"
Then I save current URL with name "announcement_only_for_fapple_private"
## Finish tests with fapple now check access with acostea ##
Given I am logged as "acostea"
And I am on course "TEMP" homepage
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
Then I should see "Group 0001"
And I should see "Group 0002"
And I should see "Group 0003"
And I should see "Group 0004"
Then I visit URL saved with name "announcement_for_user_fapple_group_0001_public"
Then I should see "Sorry, you are not allowed to access this page"
Then I visit URL saved with name "announcement_for_all_users_group_0001_public"
Then I should see "Sorry, you are not allowed to access this page"
Then I visit URL saved with name "announcement_only_for_fapple_private"
Then I should see "Sorry, you are not allowed to access this page"
Given I am logged as "acostea"
And I am on course "TEMP" homepage
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
Then I should see "Group 0001"
And I should see "Group 0002"
And I should see "Group 0003"
And I should see "Group 0004"
And I should see "Group 0005"
Then I visit URL saved with name "announcement_for_user_fapple_group_0001_public"
Then I should see "Sorry, you are not allowed to access this page"
Then I visit URL saved with name "announcement_for_all_users_group_0001_public"
Then I should see "Sorry, you are not allowed to access this page"
Then I visit URL saved with name "announcement_for_user_fapple_group_0003_private"
Then I should see "Sorry, you are not allowed to access this page"
Then I visit URL saved with name "announcement_for_all_users_group_0003_private"
Then I should see "Sorry, you are not allowed to access this page"
Then I visit URL saved with name "announcement_only_for_fapple_private"
Then I should see "Sorry, you are not allowed to access this page"

@ -51,7 +51,6 @@ Feature: LP tool
And I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list"
Then I should see "LP 1"
# Scenario: Check the PDF export in LP list if hide SCORM PDF link is false
# Given I am on "/main/admin/settings.php?category=Course"
# And I check the "hide_scorm_pdf_link" radio button with "false" value
@ -65,6 +64,7 @@ Feature: LP tool
# And I press "Save settings"
# And I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list&isStudentView=true"
# Then I should not see an icon with title "Export to PDF"
Scenario: LP exists and LP category exists
And I am on "/main/lp/lp_controller.php?cidReq=TEMP&id_session=0&gidReq=0&gradebook=0&origin="
Then I should see "LP 1"

@ -1,4 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script checks and updates (if you uncomment the query)
* the records in track_e_course_access that is used to calculate the

@ -24,7 +24,7 @@ foreach ($settingsCurrent as $settingCurrent) {
[
$settingCurrent->getVariable(),
$settingCurrent->getSubkey(),
$settingCurrent->getUrl()
$settingCurrent->getAccessUrl()
]
);
@ -68,7 +68,7 @@ if (empty($duplicatedCurrent)) {
foreach ($duplicatedCurrent as $settingCurrent) {
echo vsprintf(
"variable = '%s' subkey = '%s' access_url = '%s'<br>" . PHP_EOL,
[$settingCurrent->getVariable(), $settingCurrent->getSubkey(), $settingCurrent->getUrl()]
[$settingCurrent->getVariable(), $settingCurrent->getSubkey(), $settingCurrent->getAccessUrl()]
);
$entityManager->remove($settingCurrent);

@ -1,4 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script synchronize the exercise score (track_e_exercises.exe_result)
* with the LP score result (lp_item_view.score).
@ -16,9 +18,9 @@ $tableCourse = Database::get_main_table(TABLE_MAIN_COURSE);
$sql = "SELECT
exe_id,
score,
exe_result,
exe_user_id,
score,
exe_result,
exe_exo_id,
orig_lp_id,
orig_lp_item_view_id,
@ -74,17 +76,17 @@ if (!empty($items)) {
$count = count($attempts);
if ($count == 1) {
$attempt = current($attempts);
$score = $item['score'];
$score = $item['exe_result'];
/* The attempt has empty score and the LP is good
/* The attempt has empty exe_result and the LP is good
there must be another attempt, do nothing. */
if ((empty($item['score']) || $item['score'] == 0) && !empty($attempt['score'])) {
if ((empty($item['exe_result']) || $item['exe_result'] == 0) && !empty($attempt['score'])) {
var_dump('Skipped');
echo '<br />';
continue;
}
echo "Score: ".$attempt['score']. ' - '.$item['score'].'<br />';
echo "Score: ".$attempt['score']. ' - '.$item['exe_result'].'<br />';
$itemViewId = $attempt['lp_item_view_id'];
$sql = "UPDATE $table SET
@ -106,8 +108,8 @@ if (!empty($items)) {
} else {
echo 'Cannot update multiple attempts checking attempts:<br />';
foreach ($attempts as $attempt) {
if ($attempt['score'] == $item['score']) {
/*echo "Score: ".$attempt['score']. ' - '.$item['score'].'<br />';
if ($attempt['score'] == $item['exe_result']) {
/*echo "Score: ".$attempt['score']. ' - '.$item['exe_result'].'<br />';
$itemViewId = $attempt['id'];
$sql = "UPDATE $tableExercise
SET orig_lp_item_view_id = $itemViewId

@ -1,4 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script fixes use of id instead of iid for the learning path
*/

@ -1,4 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script try to fix the lp items path for missing files
* It's useful when the path field in c_lp_item table has a value like 'document/item_file.html'

@ -27,7 +27,7 @@ $students = Database::store_result($result);
if (!empty($students)) {
foreach ($students as $student) {
var_dump($student['username'].'- '.$student['user_id']);
$result = CourseManager::add_user_to_course($student['user_id'], $courseCode);
$result = CourseManager::subscribeUser($student['user_id'], $courseCode);
var_dump($result);
echo '<br />';
}

Loading…
Cancel
Save