diff --git a/test/unitTests/app/user/UserControllerTest.php b/test/unitTests/app/user/UserControllerTest.php index b1ba4deef84f1c4b0f4307ab6c22ee1c7392799a..da412c018055843b0e032e514982c443e9f44764 100755 --- a/test/unitTests/app/user/UserControllerTest.php +++ b/test/unitTests/app/user/UserControllerTest.php @@ -759,7 +759,7 @@ class UserControllerTest extends TestCase $request = \Slim\Http\Request::createFromEnvironment($environment); $aArgs = [ 'firstname' => 'Super', - 'lastname' => 'ADMIN', + 'lastname' => 'Admin', 'mail' => 'dev@maarch.org', 'initials' => 'SU' ]; @@ -778,9 +778,25 @@ class UserControllerTest extends TestCase $this->assertSame('superadmin', $responseBody->user_id); $this->assertSame('Super', $responseBody->firstname); - $this->assertSame('ADMIN', $responseBody->lastname); + $this->assertSame('Admin', $responseBody->lastname); $this->assertSame('dev@maarch.org', $responseBody->mail); $this->assertSame('SU', $responseBody->initials); + + // CORRECT UPDATE + $environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'PUT']); + $request = \Slim\Http\Request::createFromEnvironment($environment); + $aArgs = [ + 'firstname' => 'Super', + 'lastname' => 'ADMIN', + 'mail' => 'dev@maarch.org', + 'initials' => 'SU' + ]; + $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request); + + $response = $userController->updateProfile($fullRequest, new \Slim\Http\Response()); + $responseBody = json_decode((string)$response->getBody()); + + $this->assertSame('success', $responseBody->success); } public function testSetRedirectedBasket()