From f614c42b78e04f6bb21b7a4ba6886deba76c0332 Mon Sep 17 00:00:00 2001 From: "florian.azizian" <florian.azizian@maarch.org> Date: Fri, 13 Nov 2020 19:00:08 +0100 Subject: [PATCH] FEAT #14567 TIME 0:15 fix TU --- phpunit.xml | 2 +- src/app/user/models/UserModel.php | 2 +- .../ConfigurationControllerTest.php | 8 +++---- .../app/document/DocumentControllerTest.php | 24 +++++++++---------- .../app/group/GroupControllerTest.php | 8 +++---- .../app/history/HistoryControllerTest.php | 12 +++++----- .../unitTests/app/user/UserControllerTest.php | 10 ++++---- .../core/AuthenticationControllerTest.php | 6 ++--- .../unitTests/core/PasswordControllerTest.php | 7 +++--- 9 files changed, 39 insertions(+), 40 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 57b17e85e0..52bfc29d27 100755 --- a/phpunit.xml +++ b/phpunit.xml @@ -20,7 +20,7 @@ </filter> <logging> <log type="coverage-clover" target="test/unitTests/build/tests-clover.xml"/> - <log type="junit" target="test/unitTests/build/tests-phpunit.xml" logIncompleteSkipped="false"/> + <log type="junit" target="test/unitTests/build/tests-phpunit.xml"/> <log type="coverage-html" target="test/unitTests/build" lowUpperBound="35" highLowerBound="70"/> </logging> </phpunit> diff --git a/src/app/user/models/UserModel.php b/src/app/user/models/UserModel.php index 678ee2688c..19bca24fb1 100755 --- a/src/app/user/models/UserModel.php +++ b/src/app/user/models/UserModel.php @@ -96,7 +96,7 @@ class UserModel '"isRest"' => empty($args['isRest']) ? 'false' : 'true', 'picture' => $args['picture'], 'password_modification_date' => 'CURRENT_TIMESTAMP', - 'signature_mode' => $args['signatureModes'] + 'signature_modes' => $args['signatureModes'] ] ]); diff --git a/test/unitTests/app/configuration/ConfigurationControllerTest.php b/test/unitTests/app/configuration/ConfigurationControllerTest.php index d047dde134..d9957cee21 100755 --- a/test/unitTests/app/configuration/ConfigurationControllerTest.php +++ b/test/unitTests/app/configuration/ConfigurationControllerTest.php @@ -109,7 +109,7 @@ class ConfigurationControllerTest extends TestCase $response = $configurationController->get($fullRequest, new \Slim\Http\Response()); $responseBody = json_decode((string)$response->getBody()); - $this->assertInternalType('array', $responseBody->configurations); + $this->assertIsArray($responseBody->configurations); $this->assertNotEmpty($responseBody->configurations); foreach ($responseBody->configurations as $configuration) { if ($configuration->label == self::$ldapLabel) { @@ -123,7 +123,7 @@ class ConfigurationControllerTest extends TestCase $response = $configurationController->get($fullRequest, new \Slim\Http\Response()); $responseBody = json_decode((string)$response->getBody()); - $this->assertInternalType('array', $responseBody->configurations); + $this->assertIsArray($responseBody->configurations); $this->assertNotEmpty($responseBody->configurations); foreach ($responseBody->configurations as $configuration) { if ($configuration->label == self::$emailLabel) { @@ -138,8 +138,8 @@ class ConfigurationControllerTest extends TestCase $responseBody = json_decode((string)$response->getBody()); $this->assertNotEmpty($responseBody->configurations); - $this->assertInternalType('string', $responseBody->configurations->value); - $this->assertInternalType('array', $responseBody->configurations->availableConnections); + $this->assertIsString($responseBody->configurations->value); + $this->assertIsArray($responseBody->configurations->availableConnections); //Errors diff --git a/test/unitTests/app/document/DocumentControllerTest.php b/test/unitTests/app/document/DocumentControllerTest.php index 2332eefa84..9fab250a6d 100755 --- a/test/unitTests/app/document/DocumentControllerTest.php +++ b/test/unitTests/app/document/DocumentControllerTest.php @@ -47,7 +47,7 @@ class DocumentControllerTest extends TestCase $response = $documentController->create($fullRequest, new \Slim\Http\Response()); $responseBody = json_decode((string)$response->getBody()); - $this->assertInternalType('int', $responseBody->id); + $this->assertIsInt($responseBody->id); self::$id = $responseBody->id; } @@ -61,19 +61,19 @@ class DocumentControllerTest extends TestCase $response = $documentController->get($request, new \Slim\Http\Response()); $responseBody = json_decode((string)$response->getBody()); - $this->assertInternalType('array', $responseBody->documents); + $this->assertIsArray($responseBody->documents); $this->assertNotEmpty($responseBody->documents); - $this->assertInternalType('int', $responseBody->count->visa); - $this->assertInternalType('int', $responseBody->count->sign); - $this->assertInternalType('int', $responseBody->count->note); - $this->assertInternalType('int', $responseBody->count->current); + $this->assertIsInt($responseBody->count->visa); + $this->assertIsInt($responseBody->count->sign); + $this->assertIsInt($responseBody->count->note); + $this->assertIsInt($responseBody->count->current); $this->assertNotEmpty($responseBody->count); $fullRequest = $request->withQueryParams(['mode' => 'SIGN']); $response = $documentController->get($fullRequest, new \Slim\Http\Response()); $responseBody = json_decode((string)$response->getBody()); - $this->assertInternalType('array', $responseBody->documents); + $this->assertIsArray($responseBody->documents); $this->assertNotEmpty($responseBody->documents); } @@ -93,14 +93,14 @@ class DocumentControllerTest extends TestCase $this->assertSame('2018/CR/7', $responseBody->document->reference); $this->assertSame('Mon Courrier', $responseBody->document->title); $this->assertSame('Oliver Queen', $responseBody->document->sender); - $this->assertInternalType('array', $responseBody->document->metadata); + $this->assertIsArray($responseBody->document->metadata); $this->assertNotEmpty($responseBody->document->metadata); - $this->assertInternalType('array', $responseBody->document->workflow); - $this->assertInternalType('int', $responseBody->document->workflow[0]->userId); + $this->assertIsArray($responseBody->document->workflow); + $this->assertIsInt($responseBody->document->workflow[0]->userId); $this->assertSame(1, $responseBody->document->workflow[0]->userId); $this->assertSame('visa', $responseBody->document->workflow[0]->mode); $this->assertNotEmpty($responseBody->document->workflow); - $this->assertInternalType('array', $responseBody->document->attachments); + $this->assertIsArray($responseBody->document->attachments); $this->assertNotEmpty($responseBody->document->attachments); $this->assertNotEmpty($responseBody->document->attachments[0]->id); self::$attachmentId = $responseBody->document->attachments[0]->id; @@ -124,7 +124,7 @@ class DocumentControllerTest extends TestCase $this->assertSame('2018/ZZ/10', $responseBody->attachment->reference); $this->assertSame('Ma pj de mon courrier', $responseBody->attachment->title); - $this->assertInternalType('string', $responseBody->attachment->encodedDocument); + $this->assertIsString($responseBody->attachment->encodedDocument); $response = $attachmentController->getById($request, new \Slim\Http\Response(), ['id' => -1]); $responseBody = json_decode((string)$response->getBody()); diff --git a/test/unitTests/app/group/GroupControllerTest.php b/test/unitTests/app/group/GroupControllerTest.php index 49000f1e9b..f5ec0e398c 100755 --- a/test/unitTests/app/group/GroupControllerTest.php +++ b/test/unitTests/app/group/GroupControllerTest.php @@ -29,7 +29,7 @@ class GroupControllerTest extends TestCase $responseBody = json_decode((string)$response->getBody()); $this->assertNotEmpty($responseBody->id); - $this->assertInternalType('int', $responseBody->id); + $this->assertIsInt($responseBody->id); self::$groupId = $responseBody->id; //Label missing @@ -117,7 +117,7 @@ class GroupControllerTest extends TestCase $this->assertNotEmpty($responseBody->group); $this->assertSame(self::$groupId, $responseBody->group->id); $this->assertSame('Test TU 2', $responseBody->group->label); - $this->assertInternalType('array', $responseBody->group->users); + $this->assertIsArray($responseBody->group->users); $this->assertNotEmpty($responseBody->group->users); $this->assertSame(1, $responseBody->group->users[0]->id); $this->assertNotEmpty($responseBody->group->users[0]->firstname); @@ -153,9 +153,9 @@ class GroupControllerTest extends TestCase $response = $groupController->get($request, new \Slim\Http\Response()); $responseBody = json_decode((string)$response->getBody()); - $this->assertInternalType('array', $responseBody->groups); + $this->assertIsArray($responseBody->groups); $this->assertNotEmpty($responseBody->groups); - $this->assertInternalType('int', $responseBody->groups[0]->id); + $this->assertIsInt($responseBody->groups[0]->id); $this->assertNotEmpty($responseBody->groups[0]->label); } diff --git a/test/unitTests/app/history/HistoryControllerTest.php b/test/unitTests/app/history/HistoryControllerTest.php index 12af3349de..89f4f81956 100755 --- a/test/unitTests/app/history/HistoryControllerTest.php +++ b/test/unitTests/app/history/HistoryControllerTest.php @@ -42,14 +42,14 @@ class HistoryControllerTest extends TestCase $this->assertSame(200, $response->getStatusCode()); $responseBody = json_decode((string)$response->getBody()); - $this->assertInternalType('array', $responseBody->history); + $this->assertIsArray($responseBody->history); $this->assertNotEmpty($responseBody->history); - $this->assertInternalType('string', $responseBody->history[0]->code); - $this->assertInternalType('string', $responseBody->history[0]->type); - $this->assertInternalType('string', $responseBody->history[0]->user); - $this->assertInternalType('string', $responseBody->history[0]->date); - $this->assertInternalType('string', $responseBody->history[0]->message); + $this->assertIsString($responseBody->history[0]->code); + $this->assertIsString($responseBody->history[0]->type); + $this->assertIsString($responseBody->history[0]->user); + $this->assertIsString($responseBody->history[0]->date); + $this->assertIsString($responseBody->history[0]->message); $this->assertSame('OK', $responseBody->history[0]->code); diff --git a/test/unitTests/app/user/UserControllerTest.php b/test/unitTests/app/user/UserControllerTest.php index 2cedc356f9..6b0ff34861 100755 --- a/test/unitTests/app/user/UserControllerTest.php +++ b/test/unitTests/app/user/UserControllerTest.php @@ -32,7 +32,7 @@ class UserControllerTest extends TestCase $response = $userController->create($fullRequest, new \Slim\Http\Response()); $responseBody = json_decode((string)$response->getBody()); - $this->assertInternalType('int', $responseBody->id); + $this->assertIsInt($responseBody->id); self::$userId = $responseBody->id; //Mail missing @@ -132,7 +132,7 @@ class UserControllerTest extends TestCase $response = $userController->get($request, new \Slim\Http\Response()); $responseBody = json_decode((string)$response->getBody()); - $this->assertInternalType('array', $responseBody->users); + $this->assertIsArray($responseBody->users); $this->assertNotEmpty($responseBody->users); } @@ -195,7 +195,7 @@ class UserControllerTest extends TestCase $response = $userController->update($fullRequest, new \Slim\Http\Response(), ['id' => self::$userId]); $responseBody = json_decode((string)$response->getBody()); - $this->assertInternalType('object', $responseBody->user); + $this->assertIsObject($responseBody->user); $this->assertNotEmpty($responseBody->user); $response = $userController->getById($request, new \Slim\Http\Response(), ['id' => self::$userId]); @@ -230,7 +230,7 @@ class UserControllerTest extends TestCase $response = $signatureController->create($fullRequest, new \Slim\Http\Response(), ['id' => self::$userId]); $responseBody = json_decode((string)$response->getBody()); - $this->assertInternalType('int', $responseBody->signatureId); + $this->assertIsInt($responseBody->signatureId); self::$signatureId = $responseBody->signatureId; $GLOBALS['id'] = $previousUserId; } @@ -247,7 +247,7 @@ class UserControllerTest extends TestCase $response = $signatureController->get($request, new \Slim\Http\Response(), ['id' => self::$userId]); $responseBody = json_decode((string)$response->getBody()); - $this->assertInternalType('array', $responseBody->signatures); + $this->assertIsArray($responseBody->signatures); $this->assertNotEmpty($responseBody->signatures); $GLOBALS['id'] = $previousUserId; } diff --git a/test/unitTests/core/AuthenticationControllerTest.php b/test/unitTests/core/AuthenticationControllerTest.php index 93b41f816b..ecf86d0046 100755 --- a/test/unitTests/core/AuthenticationControllerTest.php +++ b/test/unitTests/core/AuthenticationControllerTest.php @@ -22,8 +22,8 @@ class AuthenticationControllerTest extends TestCase $this->assertSame(200, $response->getStatusCode()); $responseBody = json_decode((string)$response->getBody()); - $this->assertInternalType('string', $responseBody->connection); - $this->assertInternalType('boolean', $responseBody->changeKey); + $this->assertIsString($responseBody->connection); + $this->assertIsBool($responseBody->changeKey); $this->assertNotEmpty($responseBody->connection); } @@ -74,6 +74,6 @@ class AuthenticationControllerTest extends TestCase $response = \SrcCore\controllers\AuthenticationController::authentication(); $this->assertNotEmpty($response); - $this->assertInternalType('int', $response); + $this->assertIsInt($response); } } diff --git a/test/unitTests/core/PasswordControllerTest.php b/test/unitTests/core/PasswordControllerTest.php index 115228cc20..87f0c2764e 100755 --- a/test/unitTests/core/PasswordControllerTest.php +++ b/test/unitTests/core/PasswordControllerTest.php @@ -25,11 +25,10 @@ class PasswordControllerTest extends TestCase foreach ($responseBody->rules as $value) { $this->assertNotEmpty($value->id); - $this->assertInternalType('int', $value->id); + $this->assertIsInt($value->id); $this->assertNotEmpty($value->label); - $this->assertInternalType('int', $value->value); - $this->assertInternalType('boolean', $value->enabled); + $this->assertIsInt($value->value); + $this->assertIsBool($value->enabled); } - } } -- GitLab