Behat - fix tests

pull/3064/head
Julio 6 years ago
parent 164a3ad236
commit 8f4c4b7b76
  1. 5
      config/packages/twig.yaml
  2. 2
      public/main/group/group_creation.php
  3. 8
      public/main/inc/lib/link.lib.php
  4. 2
      public/main/link/link.php
  5. 8
      public/main/work/edit_work.php
  6. 7
      public/main/work/work.lib.php
  7. 4
      tests/behat/features/toolWork.feature

@ -1,6 +1,9 @@
twig:
debug: '%kernel.debug%'
paths: ['%kernel.project_dir%/var/templates', '%kernel.project_dir%/public/main/template/', '%kernel.project_dir%/public/plugin/']
paths:
- '%kernel.project_dir%/var/templates'
- '%kernel.project_dir%/public/main/template'
- '%kernel.project_dir%/public/plugin'
form_themes:
- 'bootstrap_4_layout.html.twig'
- '@SonataFormatter/Form/formatter.html.twig'

@ -245,7 +245,7 @@ EOT;
$create_groups_form = new FormValidator('create_groups', 'post', api_get_self().'?'.api_get_cidreq());
$create_groups_form->addElement('header', $nameTools);
$create_groups_form->addText('number_of_groups', get_lang('Number of groups to create'), null, ['value' => '1']);
$create_groups_form->addButton('submit', get_lang('ProceedToCreate group(s)'), 'plus', 'primary');
$create_groups_form->addButton('submit', get_lang('Proceed to create group(s)'), 'plus', 'primary');
$defaults = [];
$defaults['number_of_groups'] = 1;
$create_groups_form->setDefaults($defaults);

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CLink;
@ -17,8 +18,6 @@ use Chamilo\CourseBundle\Entity\CLink;
*
* @author Patrick Cool, complete remake (December 2003 - January 2004)
* @author René Haentjens, CSV file import (October 2004)
*
* @package chamilo.link
*/
class Link extends Model
{
@ -579,7 +578,6 @@ class Link extends Model
'display_order' => $max_display_order,
'on_homepage' => $values['on_homepage'],
'target' => $values['target'],
'category_id' => $values['category_id'],
];
Database::update(
@ -747,7 +745,7 @@ class Link extends Model
{
$table = Database::get_course_table(TABLE_LINK_CATEGORY);
$course_id = api_get_course_int_id();
$id = intval($id);
$id = (int) $id;
// This is used to put the modified info of the category-form into the database.
$params = [
@ -1623,7 +1621,7 @@ Do you really want to delete this category and its links ?')."')) return false;\
$form->addText('url', 'URL');
$form->addRule('url', get_lang('Please give the link URL, it should be valid.'), 'url');
$form->addText('title', get_lang('LinksName'));
$form->addHtmlEditor('description', get_lang('Description'), true, false, ['ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130']);
$form->addHtmlEditor('description', get_lang('Description'), false, false, ['ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130']);
$resultcategories = self::getLinkCategories($course_id, $session_id);
$options = ['0' => '--'];

@ -45,9 +45,7 @@ $id = !empty($_REQUEST['id']) ? $_REQUEST['id'] : '';
$action = !empty($_REQUEST['action']) ? $_REQUEST['action'] : '';
$nameTools = get_lang('Links');
$course_id = api_get_course_int_id();
// Condition for the session
$session_id = api_get_session_id();
if ('addlink' === $action) {

@ -116,14 +116,8 @@ if ($form->validate()) {
}
$workId = $params['work_id'];
$editCheck = false;
$workData = get_work_data_by_id($workId);
if (!empty($workData)) {
$editCheck = true;
} else {
$editCheck = true;
}
$editCheck = true;
if ($editCheck) {
updateWork($workData['iid'], $params, $courseInfo, $sessionId);

@ -136,6 +136,10 @@ function get_work_data_by_id($id, $courseId = 0, $sessionId = 0)
if ($studentPublication) {
$workId = $studentPublication->getIid();
$work['id'] = $workId;
$work['iid'] = $workId;
$work['description'] = $studentPublication->getDescription();
$work['url'] = $studentPublication->getUrl();
$work['active'] = $studentPublication->getActive();
$work['allow_text_assignment'] = $studentPublication->getAllowTextAssignment();
$work['c_id'] = $studentPublication->getCId();
@ -143,7 +147,6 @@ function get_work_data_by_id($id, $courseId = 0, $sessionId = 0)
$work['parent_id'] = $studentPublication->getParentId();
$work['qualification'] = $studentPublication->getQualification();
$work['contains_file'] = $studentPublication->getContainsFile();
$work['title'] = $studentPublication->getTitle();
if (empty($studentPublication->getTitle())) {
$work['title'] = basename($studentPublication->getUrl());
@ -4353,7 +4356,7 @@ function updateWork($workId, $params, $courseInfo, $sessionId = 0)
$filteredParams = [
'description' => $params['description'],
'qualification' => $params['qualification'],
'weight' => $params['weight'],
'weight' => (float) $params['weight'],
'allow_text_assignment' => $params['allow_text_assignment'],
];

@ -34,8 +34,8 @@ Feature: Work tool
Then I follow "Upload my assignment"
Then I should see "Upload a document"
Then I follow "Upload (Simple)"
Then I should see "File extension"
Then I attach the file "/public/favicon.ico" to "file"
#Then I should see "File extension"
Then I attach the file "/public/favicon.ico" to "file_upload"
And I press "Upload"
And wait for the page to be loaded
Then I should see "The file has been added to the list of publications"

Loading…
Cancel
Save