Skip to content
Snippets Groups Projects
Commit a471b061 authored by Jean-Laurent DUZANT's avatar Jean-Laurent DUZANT
Browse files

FEAT #20145 TIME 0:10 remove phone key in test obj && set fingerprint back to optional

parent 19d0768b
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="test/unitTests/define.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<php>
<server name='HTTP_HOST' value='http://localhost/MaarchParapheurDevelop' />
<server name='HTTP_HOST' value='http://localhost/MaarchParapheur' />
<server name='SERVER_PORT' value='80' />
</php>
<coverage>
......
......@@ -135,8 +135,6 @@ class UserController
return $response->withStatus(400)->withJson(['errors' => 'Body email is empty or not a valid email']);
} elseif (!empty($body['x509Fingerprint']) && !Validator::stringType()->validate($body['x509Fingerprint'])) {
return $response->withStatus(400)->withJson(['errors' => 'Body x509Fingerprint is not a string']);
} elseif (!Validator::stringType()->notEmpty()->validate($body['phone'])) {
return $response->withStatus(400)->withJson(['errors' => 'Body phone is empty or not a string']);
}
$body['login'] = strtolower($body['login']);
......@@ -145,6 +143,10 @@ class UserController
return $response->withStatus(400)->withJson(['errors' => 'Login already exists', 'lang' => 'userLoginAlreadyExists']);
}
if (!empty($body['x509Fingerprint'])) {
$body['x509_fingerprint'] = $body['x509Fingerprint'];
}
if (!empty($body['isRest'])) {
$body['"isRest"'] = true;
}
......@@ -205,8 +207,6 @@ class UserController
return $response->withStatus(400)->withJson(['errors' => 'Body email is empty or not a valid email']);
} elseif (!empty($body['x509Fingerprint']) && !Validator::stringType()->validate($body['x509Fingerprint'])) {
return $response->withStatus(400)->withJson(['errors' => 'Body x509Fingerprint is not a string']);
} elseif (!Validator::stringType()->notEmpty()->validate($body['phone'])) {
return $response->withStatus(400)->withJson(['errors' => 'Body phone is empty or not a string']);
}
$user = UserModel::getById(['id' => $args['id'], 'select' => [1]]);
......@@ -218,7 +218,6 @@ class UserController
'firstname' => $body['firstname'],
'lastname' => $body['lastname'],
'email' => $body['email'],
'phone' => $body['phone'],
'signature_modes' => []
];
......
......@@ -96,12 +96,10 @@ class UserModel
'password' => $args['password'],
'firstname' => $args['firstname'],
'lastname' => $args['lastname'],
'phone' => $args['phone'],
'"isRest"' => empty($args['isRest']) ? 'false' : 'true',
'picture' => $args['picture'],
'password_modification_date' => 'CURRENT_TIMESTAMP',
'signature_modes' => $args['signatureModes'],
'x509_fingerprint' => $args['x509_fingerprint']
'signature_modes' => $args['signatureModes']
]
]);
......
......@@ -25,9 +25,7 @@ class UserControllerTest extends TestCase
'login' => 'emailLogin',
'firstname' => 'Prénom',
'lastname' => 'Nom',
'email' => 'email@test.fr',
'phone' => '0701020304',
'x509_fingerprint' => 'fingerprint'
'email' => 'email@test.fr'
];
$fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request);
......@@ -206,8 +204,7 @@ class UserControllerTest extends TestCase
$aArgs = [
'firstname' => 'Jolly',
'lastname' => 'Jumper',
'email' => 'email@test.fr',
'phone' => '0701020304'
'email' => 'email@test.fr'
];
$fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment