Minor - fix behat tests, php errors.

pull/3768/head
Julio Montoya 4 years ago
parent 3d80c0d5e0
commit a94a51da2f
  1. 5
      public/main/group/group.php
  2. 10
      public/main/group/settings.php
  3. 1
      public/main/inc/lib/groupmanager.lib.php
  4. 2
      public/main/lp/lp_subscribe_users_to_category.php
  5. 2
      src/CoreBundle/Entity/ExtraFieldValues.php
  6. 15
      tests/behat/features/toolExercise.feature

@ -227,6 +227,7 @@ if (api_is_allowed_to_edit(false, true)) {
$actionsRight = GroupManager::getSearchForm(); $actionsRight = GroupManager::getSearchForm();
$toolbar = Display::toolbarAction('toolbar-groups', [$actionsLeft, $actionsRight]); $toolbar = Display::toolbarAction('toolbar-groups', [$actionsLeft, $actionsRight]);
$categories = GroupManager::get_categories(); $categories = GroupManager::get_categories();
echo $toolbar; echo $toolbar;
echo UserManager::getUserSubscriptionTab(3); echo UserManager::getUserSubscriptionTab(3);
@ -250,10 +251,6 @@ if ('true' === api_get_setting('allow_group_categories')) {
); );
$groupToShow = GroupManager::processGroups($groupList, $categoryId); $groupToShow = GroupManager::processGroups($groupList, $categoryId);
if (empty($groupToShow)) {
continue;
}
if (empty($categoryId) && empty($groupList)) { if (empty($categoryId) && empty($groupList)) {
continue; continue;
} }

@ -10,6 +10,10 @@
* *
* @todo course admin functionality to create groups based on who is in which course (or class). * @todo course admin functionality to create groups based on who is in which course (or class).
*/ */
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CGroup;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
$current_course_tool = TOOL_GROUP; $current_course_tool = TOOL_GROUP;
@ -18,8 +22,8 @@ api_protect_course_script(true);
$group_id = api_get_group_id(); $group_id = api_get_group_id();
$current_group = GroupManager::get_group_properties($group_id); $current_group = GroupManager::get_group_properties($group_id);
$groupRepo = \Chamilo\CoreBundle\Framework\Container::getGroupRepository(); $groupRepo = Container::getGroupRepository();
/** @var \Chamilo\CourseBundle\Entity\CGroup $groupEntity */ /** @var CGroup $groupEntity */
$groupEntity = $groupRepo->find($group_id); $groupEntity = $groupRepo->find($group_id);
if (empty($groupEntity)) { if (empty($groupEntity)) {
@ -364,7 +368,7 @@ if ($form->validate()) {
$defaults = $current_group; $defaults = $current_group;
$category = GroupManager::get_category_from_group($current_group['iid']); $category = GroupManager::get_category_from_group($current_group['iid']);
if (!empty($category)) { if (!empty($category)) {
$defaults['category_id'] = $category['id']; $defaults['category_id'] = $category['iid'];
} }
$action = isset($_GET['action']) ? $_GET['action'] : ''; $action = isset($_GET['action']) ? $_GET['action'] : '';

@ -873,7 +873,6 @@ class GroupManager
return false; return false;
} }
$courseId = $course_info['real_id'];
$sql = "SELECT gc.* FROM $table_group_cat gc $sql = "SELECT gc.* FROM $table_group_cat gc
INNER JOIN $table_group g INNER JOIN $table_group g
ON (gc.iid = g.category_id) ON (gc.iid = g.category_id)

@ -191,7 +191,7 @@ if ($allowUserGroups) {
} }
} }
$em->merge($category); $em->persist($category);
$em->flush(); $em->flush();
Display::addFlash(Display::return_message(get_lang('Updated'))); Display::addFlash(Display::return_message(get_lang('Updated')));
} else { } else {

@ -22,7 +22,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\ExtraFieldValuesRepository") * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\ExtraFieldValuesRepository")
* @ORM\MappedSuperclass * @ORM\MappedSuperclass
*/ */
class ExtraFieldValues // extends BaseAttributeValue class ExtraFieldValues
{ {
use TimestampableEntity; use TimestampableEntity;

@ -13,6 +13,7 @@ Feature: Exercise tool
| category_name | Category 1 | | category_name | Category 1 |
And I fill in ckeditor field "category_description" with "Category 1 description" And I fill in ckeditor field "category_description" with "Category 1 description"
And I press "SubmitNote" And I press "SubmitNote"
And wait for the page to be loaded
Then I should see "Category added" Then I should see "Category added"
Scenario: Create a second question category Scenario: Create a second question category
@ -22,6 +23,7 @@ Feature: Exercise tool
| category_name | Category 2 | | category_name | Category 2 |
And I fill in ckeditor field "category_description" with "Category 2 description" And I fill in ckeditor field "category_description" with "Category 2 description"
And I press "SubmitNote" And I press "SubmitNote"
And wait for the page to be loaded
Then I should see "Category added" Then I should see "Category added"
Scenario: Create an exercise Scenario: Create an exercise
@ -31,6 +33,7 @@ Feature: Exercise tool
| exercise_title | Exercise 1 | | exercise_title | Exercise 1 |
And I fill in ckeditor field "exerciseDescription" with "Exercise description" And I fill in ckeditor field "exerciseDescription" with "Exercise description"
And I press "submitExercise" And I press "submitExercise"
And wait for the page to be loaded
Then I should see "Test added" Then I should see "Test added"
Scenario: Edit an exercise Scenario: Edit an exercise
@ -39,6 +42,7 @@ Feature: Exercise tool
And I follow "Edit" And I follow "Edit"
And I follow "Edit test name and settings" And I follow "Edit test name and settings"
And I press "submitExercise" And I press "submitExercise"
And wait for the page to be loaded
Then I should see "Test name and settings have been saved." Then I should see "Test name and settings have been saved."
Scenario: Add question "Multiple choice" to exercise created "Exercise 1" Scenario: Add question "Multiple choice" to exercise created "Exercise 1"
@ -59,6 +63,7 @@ Feature: Exercise tool
Then I fill in ckeditor field "comment[3]" with "Comment false" Then I fill in ckeditor field "comment[3]" with "Comment false"
Then I fill in ckeditor field "comment[4]" with "Comment false" Then I fill in ckeditor field "comment[4]" with "Comment false"
And I press "submit-question" And I press "submit-question"
And wait for the page to be loaded
Then I should see "Item added" Then I should see "Item added"
Scenario: Add question "Multiple answer" to exercise created "Exercise 1" Scenario: Add question "Multiple answer" to exercise created "Exercise 1"
@ -80,6 +85,7 @@ Feature: Exercise tool
Then I fill in ckeditor field "comment[3]" with "Comment false" Then I fill in ckeditor field "comment[3]" with "Comment false"
Then I fill in ckeditor field "comment[4]" with "Comment false" Then I fill in ckeditor field "comment[4]" with "Comment false"
And I press "submit-question" And I press "submit-question"
And wait for the page to be loaded
Then I should see "Item added" Then I should see "Item added"
Scenario: Add question "Fill in blanks" to "Exercise 1" Scenario: Add question "Fill in blanks" to "Exercise 1"
@ -91,6 +97,7 @@ Feature: Exercise tool
| questionName | Fill blanks | | questionName | Fill blanks |
Then I fill in ckeditor field "answer" with "Romeo and [Juliet] [Hätten||Haetten] [möchte||moechte] [wäre||waere] [können||koennen] [Könnten||Koennten] [Ärger] [voilà] [müssen] [l'été] [cherchent à] [Übung] [Ärger|Möglichkeit]" Then I fill in ckeditor field "answer" with "Romeo and [Juliet] [Hätten||Haetten] [möchte||moechte] [wäre||waere] [können||koennen] [Könnten||Koennten] [Ärger] [voilà] [müssen] [l'été] [cherchent à] [Übung] [Ärger|Möglichkeit]"
And I press "submitQuestion" And I press "submitQuestion"
And wait for the page to be loaded
Then I should see "Item added" Then I should see "Item added"
Scenario: Add question "Matching" to exercise created "Exercise 1" Scenario: Add question "Matching" to exercise created "Exercise 1"
@ -106,6 +113,7 @@ Feature: Exercise tool
And I fill in ckeditor field "option[2]" with "Option B" And I fill in ckeditor field "option[2]" with "Option B"
And I fill in select bootstrap static input "#matches_2" select "2" And I fill in select bootstrap static input "#matches_2" select "2"
And I press "submitQuestion" And I press "submitQuestion"
And wait for the page to be loaded
Then I should see "Item added" Then I should see "Item added"
Scenario: Add question "Open" to exercise created "Exercise 1" Scenario: Add question "Open" to exercise created "Exercise 1"
@ -117,6 +125,7 @@ Feature: Exercise tool
| questionName | Open question | | questionName | Open question |
| weighting | 10 | | weighting | 10 |
And I press "submitQuestion" And I press "submitQuestion"
And wait for the page to be loaded
Then I should see "Item added" Then I should see "Item added"
# Scenario: Add question "Oral expression" to exercise created "Exercise 1" # Scenario: Add question "Oral expression" to exercise created "Exercise 1"
@ -144,6 +153,7 @@ Feature: Exercise tool
Then I fill in ckeditor field "comment[1]" with "Comment true" Then I fill in ckeditor field "comment[1]" with "Comment true"
Then I fill in ckeditor field "comment[2]" with "Comment false" Then I fill in ckeditor field "comment[2]" with "Comment false"
And I press "submitQuestion" And I press "submitQuestion"
And wait for the page to be loaded
Then I should see "Item added" Then I should see "Item added"
Scenario: Add question "Unique answer with unknown" to exercise created "Exercise 1" Scenario: Add question "Unique answer with unknown" to exercise created "Exercise 1"
@ -163,6 +173,7 @@ Feature: Exercise tool
Then I fill in ckeditor field "comment[2]" with "Comment false" Then I fill in ckeditor field "comment[2]" with "Comment false"
Then I fill in ckeditor field "comment[3]" with "Comment false" Then I fill in ckeditor field "comment[3]" with "Comment false"
And I press "submitQuestion" And I press "submitQuestion"
And wait for the page to be loaded
Then I should see "Item added" Then I should see "Item added"
Scenario: Add question "Multiple answer true/false/don't know" to exercise created "Exercise 1" Scenario: Add question "Multiple answer true/false/don't know" to exercise created "Exercise 1"
@ -188,6 +199,7 @@ Feature: Exercise tool
Then I fill in ckeditor field "comment[3]" with "Comment true" Then I fill in ckeditor field "comment[3]" with "Comment true"
Then I fill in ckeditor field "comment[4]" with "Comment true" Then I fill in ckeditor field "comment[4]" with "Comment true"
And I press "submitQuestion" And I press "submitQuestion"
And wait for the page to be loaded
Then I should see "Item added" Then I should see "Item added"
Scenario: Add question "Combination true/false/don't-know" to exercise created "Exercise 1" Scenario: Add question "Combination true/false/don't-know" to exercise created "Exercise 1"
@ -206,6 +218,7 @@ Feature: Exercise tool
Then I fill in ckeditor field "comment[1]" with "Comment true" Then I fill in ckeditor field "comment[1]" with "Comment true"
Then I fill in ckeditor field "comment[2]" with "Comment false" Then I fill in ckeditor field "comment[2]" with "Comment false"
And I press "submitQuestion" And I press "submitQuestion"
And wait for the page to be loaded
Then I should see "Item added" Then I should see "Item added"
Scenario: Add question "Global multiple answer" to exercise created "Exercise 1" Scenario: Add question "Global multiple answer" to exercise created "Exercise 1"
@ -230,6 +243,7 @@ Feature: Exercise tool
Then I fill in ckeditor field "comment[4]" with "Comment false" Then I fill in ckeditor field "comment[4]" with "Comment false"
And I press "submitQuestion" And I press "submitQuestion"
And wait for the page to be loaded
Then I should see "Item added" Then I should see "Item added"
Scenario: Duplicate exercise Scenario: Duplicate exercise
@ -237,6 +251,7 @@ Feature: Exercise tool
And I follow "Copy this exercise as a new one" And I follow "Copy this exercise as a new one"
And I confirm the popup And I confirm the popup
Then I should see "Exercise copied" Then I should see "Exercise copied"
And wait for the page to be loaded
And I should see "Exercise 1 - Copy" And I should see "Exercise 1 - Copy"
Scenario: Import exercise to test questions categories Scenario: Import exercise to test questions categories

Loading…
Cancel
Save