Skip to content

Commit b5d83e9

Browse files
test(password): assert 422 for failure scenarios
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 149b01a commit b5d83e9

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/php/Unit/Service/IdentifyMethod/PasswordTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,30 +201,35 @@ public static function providerValidateToSignWithCertificateData(): array {
201201
'validTo_time_t' => null,
202202
],
203203
'shouldThrow' => true,
204+
'expectedCode' => 422,
204205
],
205206
'invalid certificate - validTo_time_t is float' => [
206207
'certificateData' => [
207208
'validTo_time_t' => 1234567890.5,
208209
],
209210
'shouldThrow' => true,
211+
'expectedCode' => 422,
210212
],
211213
'invalid certificate - validTo_time_t is boolean true' => [
212214
'certificateData' => [
213215
'validTo_time_t' => true,
214216
],
215217
'shouldThrow' => true,
218+
'expectedCode' => 422,
216219
],
217220
'invalid certificate - validTo_time_t is boolean false' => [
218221
'certificateData' => [
219222
'validTo_time_t' => false,
220223
],
221224
'shouldThrow' => true,
225+
'expectedCode' => 422,
222226
],
223227
'invalid certificate - validTo_time_t is array' => [
224228
'certificateData' => [
225229
'validTo_time_t' => ['timestamp' => 1234567890],
226230
],
227231
'shouldThrow' => true,
232+
'expectedCode' => 422,
228233
],
229234
'revoked certificate' => [
230235
'certificateData' => [
@@ -254,41 +259,47 @@ public static function providerValidateToSignWithCertificateData(): array {
254259
'crl_validation' => CrlValidationStatus::URLS_INACCESSIBLE,
255260
],
256261
'shouldThrow' => true,
262+
'expectedCode' => 422,
257263
],
258264
'invalid certificate - crl validation_failed' => [
259265
'certificateData' => [
260266
'validTo_time_t' => $futureTimestamp,
261267
'crl_validation' => CrlValidationStatus::VALIDATION_FAILED,
262268
],
263269
'shouldThrow' => true,
270+
'expectedCode' => 422,
264271
],
265272
'invalid certificate - crl validation_error' => [
266273
'certificateData' => [
267274
'validTo_time_t' => $futureTimestamp,
268275
'crl_validation' => CrlValidationStatus::VALIDATION_ERROR,
269276
],
270277
'shouldThrow' => true,
278+
'expectedCode' => 422,
271279
],
272280
'invalid certificate - crl no_urls' => [
273281
'certificateData' => [
274282
'validTo_time_t' => $futureTimestamp,
275283
'crl_validation' => CrlValidationStatus::NO_URLS,
276284
],
277285
'shouldThrow' => true,
286+
'expectedCode' => 422,
278287
],
279288
'invalid certificate - crl missing' => [
280289
'certificateData' => [
281290
'validTo_time_t' => $futureTimestamp,
282291
'crl_validation' => CrlValidationStatus::MISSING,
283292
],
284293
'shouldThrow' => true,
294+
'expectedCode' => 422,
285295
],
286296
'revoked and expired certificate' => [
287297
'certificateData' => [
288298
'validTo_time_t' => $pastTimestamp,
289299
'crl_validation' => CrlValidationStatus::REVOKED,
290300
],
291301
'shouldThrow' => true,
302+
'expectedCode' => 422,
292303
],
293304
'crl missing - but validation enabled (default) still blocks' => [
294305
'certificateData' => [
@@ -303,6 +314,7 @@ public static function providerValidateToSignWithCertificateData(): array {
303314
'validTo_time_t' => 31536000, // 1971-01-01
304315
],
305316
'shouldThrow' => true,
317+
'expectedCode' => 422,
306318
],
307319
];
308320
}

0 commit comments

Comments
 (0)