diff --git a/phpunit.xml b/phpunit.xml index 57b17e85e0e142f1b2d2547988e8087bdea12889..52bfc29d27bb8a166588614abc5f79ee7f71bc56 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 678ee2688c85649d20bbe2d634243c52421e6892..19bca24fb12f9352ffbc2e90f18fa0ee517bce35 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 d047dde1346ef039ca8eeac1f88688baf5e8e80d..d9957cee216957e43dec73d4c1724c6c020cbba0 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 2332eefa848750c308b98598e56953c30484881f..9fab250a6de097ebb0b828040f0dd58d302b48a7 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 49000f1e9b040da811c1e5546f3c7ed188041400..f5ec0e398cd0f69aaf051833444e6f013ed963e7 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 12af3349de4098ff9c5acd8453b8354456f5c7fb..89f4f819563df77f0230ed9427ce3d6eb1cf4ba4 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 2cedc356f92818266ef8a45743d3ec7ba26c819f..6b0ff348619a55f1cd633ec666e0d49660de8cfc 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 93b41f816b0c3f126724a2097512d1f7d495240d..ecf86d004668970190b365f925284f41a3557383 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 115228cc20d05e184c7d095646e2697995a5a36d..87f0c2764ec1a374d8eff2b04ea984a4556e8cd9 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); } - } }