From ad26134eb7353fd61f4afe5fdfaeba13acc9c15e Mon Sep 17 00:00:00 2001
From: Guillaume Heurtier <guillaume.heurtier@maarch.org>
Date: Wed, 20 May 2020 18:17:11 +0200
Subject: [PATCH] FIX #12091 TIME 0:50 fix tests

---
 .gitlab-ci.yml                                | 28 +++++++++----------
 .../group/controllers/PrivilegeController.php |  3 +-
 .../app/contact/ContactControllerTest.php     | 19 ++++++++-----
 3 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6066d315666..637c3ec6adf 100755
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -110,17 +110,17 @@ job_php-7.2:
   except:
     - schedules
 
-pages:
-  stage: deploy
-  dependencies:
-    - job_php-7.4
-  before_script:
-    - pwd
-  script:
-    - mv test/unitTests/build/ public/
-  artifacts:
-    paths:
-      - public
-    expire_in: 1 day
-  only:
-    - develop
+#pages:
+#  stage: deploy
+#  dependencies:
+#    - job_php-7.4
+#  before_script:
+#    - pwd
+#  script:
+#    - mv test/unitTests/build/ public/
+#  artifacts:
+#    paths:
+#      - public
+#    expire_in: 1 day
+#  only:
+#    - develop
diff --git a/src/app/group/controllers/PrivilegeController.php b/src/app/group/controllers/PrivilegeController.php
index 98b9f0438e1..a751cc2a613 100644
--- a/src/app/group/controllers/PrivilegeController.php
+++ b/src/app/group/controllers/PrivilegeController.php
@@ -8,7 +8,6 @@ use Basket\models\RedirectBasketModel;
 use Group\models\GroupModel;
 use Group\models\PrivilegeModel;
 use Resource\controllers\ResController;
-use Resource\controllers\ResourceListController;
 use Resource\models\ResModel;
 use Respect\Validation\Validator;
 use Slim\Http\Request;
@@ -275,7 +274,7 @@ class PrivilegeController
             return ResController::hasRightByResId(['resId' => [$args['resId']], 'userId' => $args['userId']]);
         }
 
-        return PrivilegeController::isResourceInProcess(['userId' => $args['userId'], 'resId' => $args['resId'], 'canUpdate' => true]);
+        return PrivilegeController::isResourceInProcess(['userId' => $args['userId'], 'resId' => $args['resId'], 'canUpdateData' => true]);
     }
 
     public static function isResourceInProcess(array $args)
diff --git a/test/unitTests/app/contact/ContactControllerTest.php b/test/unitTests/app/contact/ContactControllerTest.php
index 77c64174643..0f58e8dd0ed 100755
--- a/test/unitTests/app/contact/ContactControllerTest.php
+++ b/test/unitTests/app/contact/ContactControllerTest.php
@@ -52,9 +52,11 @@ class ContactControllerTest extends TestCase
         $this->assertIsInt($responseBody['id']);
         self::$id = $responseBody['id'];
 
-        $GLOBALS['login'] = 'cchaplin';
-        $userInfo = \User\models\UserModel::getByLogin(['login' => $GLOBALS['login'], 'select' => ['id']]);
-        $GLOBALS['id'] = $userInfo['id'];
+        \User\models\UserModel::update([
+            'set'   => ['loginmode' => 'restMode'],
+            'where' => ['id = ?'],
+            'data'  => [$GLOBALS['id']]
+        ]);
 
         $args = [
             'civility'        => 'title1',
@@ -75,14 +77,17 @@ class ContactControllerTest extends TestCase
         $fullRequest = \httpRequestCustom::addContentInBody($args, $request);
 
         $response     = $contactController->create($fullRequest, new \Slim\Http\Response());
+
+        \User\models\UserModel::update([
+            'set'   => ['loginmode' => 'standard'],
+            'where' => ['id = ?'],
+            'data'  => [$GLOBALS['id']]
+        ]);
+
         $this->assertSame(200, $response->getStatusCode());
         $responseBody = json_decode((string)$response->getBody(), true);
         $this->assertSame(self::$id, $responseBody['id']);
 
-        $GLOBALS['login'] = 'superadmin';
-        $userInfo = \User\models\UserModel::getByLogin(['login' => $GLOBALS['login'], 'select' => ['id']]);
-        $GLOBALS['id'] = $userInfo['id'];
-
         $args2 = [
             'civility'           => 'title1',
             'firstname'          => 'Dwight',
-- 
GitLab