Internal - Add behat tests, fix sql errors

pull/3464/head
Julio Montoya 4 years ago
parent 74fe32fc4c
commit 95733fb71f
  1. 9
      .travis.yml
  2. 11
      public/main/inc/lib/course.lib.php
  3. 2
      tests/behat/features/createUserViaCSV.feature
  4. 1
      tests/behat/features/extraFieldUser.feature
  5. 2
      tests/behat/features/sessionAccess.feature

@ -106,17 +106,18 @@ script:
- php bin/console cache:clear
- sudo chmod -R 777 var public
- cd tests/behat
# - ../../vendor/behat/behat/bin/behat features/accessCompanyReports.feature -v
- ../../vendor/behat/behat/bin/behat features/actionUserLogin.feature -v
- ../../vendor/behat/behat/bin/behat features/adminFillUsers.feature -vvv
- ../../vendor/behat/behat/bin/behat features/adminSettings.feature -vvv
- ../../vendor/behat/behat/bin/behat features/career.feature -vvv
- ../../vendor/behat/behat/bin/behat features/class.feature -vvv
# - ../../vendor/behat/behat/bin/behat features/companyReports.feature -v
- ../../vendor/behat/behat/bin/behat features/companyReports.feature -v
- ../../vendor/behat/behat/bin/behat features/course.feature -vvv
# - ../../vendor/behat/behat/bin/behat features/course_user_registration.feature -v
- ../../vendor/behat/behat/bin/behat features/course_user_registration.feature -v
- ../../vendor/behat/behat/bin/behat features/createUser.feature -vvv
# - ../../vendor/behat/behat/bin/behat features/createUserViaCSV.feature -v
# - ../../vendor/behat/behat/bin/behat features/extraFieldUser.feature -v
- ../../vendor/behat/behat/bin/behat features/createUserViaCSV.feature -v
- ../../vendor/behat/behat/bin/behat features/extraFieldUser.feature -v
# - ../../vendor/behat/behat/bin/behat features/profile.feature -v
- ../../vendor/behat/behat/bin/behat features/promotion.feature -v
# - ../../vendor/behat/behat/bin/behat features/registration.feature -v

@ -212,8 +212,9 @@ class CourseManager
$onlyThisCourseList = []
) {
$courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
$tblCourseCategory = Database::get_main_table(TABLE_MAIN_CATEGORY);
$sql = "SELECT course.*, course.id as real_id, course_category.code AS category_code
//$tblCourseCategory = Database::get_main_table(TABLE_MAIN_CATEGORY);
// @todo fix , course_category.code AS category_code
$sql = "SELECT course.*, course.id as real_id
FROM $courseTable course ";
if (!empty($urlId)) {
@ -221,7 +222,7 @@ class CourseManager
$sql .= " INNER JOIN $table url ON (url.c_id = course.id) ";
}
$sql .= " LEFT JOIN $tblCourseCategory ON course.category_id = course_category.id ";
//$sql .= " LEFT JOIN $tblCourseCategory ON course.category_id = course_category.id ";
$visibility = (int) $visibility;
@ -297,8 +298,8 @@ class CourseManager
$sql .= ' LIMIT 1000000'; //virtually no limit
}
if (!empty($from)) {
$from = intval($from);
$sql .= ' OFFSET '.intval($from);
$from = (int) $from;
$sql .= ' OFFSET '.(int) $from;
} else {
$sql .= ' OFFSET 0';
}

@ -6,6 +6,8 @@ Feature: Users creation via CSV
And I am on "/main/admin/user_import.php"
Then I attach the file "/public/main/admin/example.csv" to "import_file"
Then I press "Import"
And wait very long for the page to be loaded
Then I should see "File imported"
Then I am on "main/admin/user_list.php?keyword=drbrown@example.net"
And wait very long for the page to be loaded
Then I should see "emmert"

@ -11,4 +11,5 @@ Feature: User extra fields
| variable | behat_extra_field |
And I fill in select bootstrap static input "#field_type" select "1"
And I press "submit"
And wait the page to be loaded when ready
Then I should see "Item added"

@ -19,7 +19,7 @@ Feature: Session access
Then I should see "Subscribe users to this session"
Then I follow "Multiple registration"
And wait the page to be loaded when ready
Then I select "Warnier Yannick (ywarnier)" from "nosessionUsersList[]"
Then I select "3" from "nosessionUsersList[]"
And I press "add_user"
And I press "next"
And wait very long for the page to be loaded

Loading…
Cancel
Save