From a97af8051851234ecb5ecddf11297b46411ecc59 Mon Sep 17 00:00:00 2001 From: Julio Date: Fri, 20 Dec 2019 15:21:01 +0100 Subject: [PATCH] Behat test: Fix createUserViaCSV.feature --- public/main/inc/lib/api.lib.php | 30 +++++++++++-------- tests/behat/features/createUserViaCSV.feature | 2 +- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/public/main/inc/lib/api.lib.php b/public/main/inc/lib/api.lib.php index 6a5ec1c89b..dce00a86a9 100644 --- a/public/main/inc/lib/api.lib.php +++ b/public/main/inc/lib/api.lib.php @@ -57,14 +57,6 @@ define('STUDENT_BOSS', 17); // student is boss define('INVITEE', 20); define('HRM_REQUEST', 21); //HRM has request for vinculation with user -// Table of status -$_status_list[COURSEMANAGER] = 'teacher'; // 1 -$_status_list[SESSIONADMIN] = 'session_admin'; // 3 -$_status_list[DRH] = 'drh'; // 4 -$_status_list[STUDENT] = 'user'; // 5 -$_status_list[ANONYMOUS] = 'anonymous'; // 6 -$_status_list[INVITEE] = 'invited'; // 20 - // COURSE VISIBILITY CONSTANTS /** only visible for course admin */ define('COURSE_VISIBILITY_CLOSED', 0); @@ -5375,6 +5367,20 @@ function api_get_software_name() } } +function api_get_status_list() +{ + $list = []; + // Table of status + $list[COURSEMANAGER] = 'teacher'; // 1 + $list[SESSIONADMIN] = 'session_admin'; // 3 + $list[DRH] = 'drh'; // 4 + $list[STUDENT] = 'user'; // 5 + $list[ANONYMOUS] = 'anonymous'; // 6 + $list[INVITEE] = 'invited'; // 20 + + return $list; +} + /** * Checks whether status given in parameter exists in the platform. * @@ -5384,9 +5390,9 @@ function api_get_software_name() */ function api_status_exists($status_asked) { - global $_status_list; + $list = api_get_status_list(); - return in_array($status_asked, $_status_list) ? true : isset($_status_list[$status_asked]); + return in_array($status_asked, $list) ? true : isset($list[$status_asked]); } /** @@ -5401,9 +5407,9 @@ function api_status_exists($status_asked) */ function api_status_key($status) { - global $_status_list; + $list = api_get_status_list(); - return isset($_status_list[$status]) ? $status : array_search($status, $_status_list); + return isset($list[$status]) ? $status : array_search($status, $list); } /** diff --git a/tests/behat/features/createUserViaCSV.feature b/tests/behat/features/createUserViaCSV.feature index 19e1dde327..91e270c749 100644 --- a/tests/behat/features/createUserViaCSV.feature +++ b/tests/behat/features/createUserViaCSV.feature @@ -4,7 +4,7 @@ Feature: Users creation via CSV Scenario: Import user via CSV Given I am a platform administrator And I am on "/main/admin/user_import.php" - Then I attach the file "/main/admin/example.csv" to "import_file" + Then I attach the file "/public/main/admin/example.csv" to "import_file" Then I press "Import" Then I should see "File imported" Then I am on "main/admin/user_list.php?keyword=drbrown@example.net"