From 9b9843e92cce8f3c45d46617315556e8fa202bea Mon Sep 17 00:00:00 2001
From: Vinciane <vinciane.bizet@maarch.org>
Date: Fri, 11 Jan 2019 12:11:11 +0100
Subject: [PATCH] FIX #CR UserController and UserCOntrollerTest

---
 src/app/user/controllers/UserController.php    |  2 +-
 test/unitTests/app/user/UserControllerTest.php | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/app/user/controllers/UserController.php b/src/app/user/controllers/UserController.php
index dddf9494144..9453c8084d4 100755
--- a/src/app/user/controllers/UserController.php
+++ b/src/app/user/controllers/UserController.php
@@ -421,7 +421,7 @@ class UserController
         $check = Validator::notEmpty()->arrayType()->validate($data['redirectedBasketIds']);
         if (!$check) {
             DatabaseModel::rollbackTransaction();
-            return $response->withStatus(400)->withJson(['errors' => 'Bad Request : redirectedBasketIds is empty or not an array']);
+            return $response->withStatus(400)->withJson(['errors' => 'RedirectedBasketIds is empty or not an array']);
         }
 
         $user = UserModel::getById(['id' => $aArgs['id'], 'select' => ['user_id']]);
diff --git a/test/unitTests/app/user/UserControllerTest.php b/test/unitTests/app/user/UserControllerTest.php
index bea1b485952..078228b325c 100755
--- a/test/unitTests/app/user/UserControllerTest.php
+++ b/test/unitTests/app/user/UserControllerTest.php
@@ -871,6 +871,18 @@ class UserControllerTest extends TestCase
 
         $user_id = \User\models\UserModel::getByLogin(['login' => 'bbain', 'select' => ['id']]);
        
+        //DELETE MANY WITH ONE ON ERROR
+         $aArgs = [
+            'redirectedBasketIds' => [ self::$redirectId, -1 ]
+        ];
+
+        $fullRequest = $request->withQueryParams($aArgs);
+
+        $response     = $userController->deleteRedirectedBasket($fullRequest, new \Slim\Http\Response(), ['id' => $user_id['id']]);
+        $responseBody = json_decode((string)$response->getBody());
+
+        $this->assertSame('Redirected basket out of perimeter', $responseBody->errors);
+
         //DELETE OK
         $aArgs = [
             'redirectedBasketIds' => [ self::$redirectId ]
-- 
GitLab