diff --git a/src/app/user/controllers/UserController.php b/src/app/user/controllers/UserController.php index dddf949414437ac07ed631d0ba4755ecdd245ca7..9453c8084d4a8d702f9fc353d713260ab5f8de95 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 bea1b485952a05c36585cce705ceaa7d5e1cf64d..078228b325c84bbd6324011e373ee936f8fa09d5 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 ]