78
78
]);
79
79
80
80
it (' throw an exception if try to call fallback with no descriprion property ' , function ($ enum , $ lang ) {
81
- expect (fn () => $ enum ->property ($ lang ))->toThrow (TranslationMissing::class);
81
+ expect (fn () => $ enum ->property ($ lang ))->toThrow (TranslationMissing::class);
82
82
})->with ([
83
83
[Status::PENDING , 'en ' ],
84
84
[StatusPascalCase::NoResponse, 'it ' ],
362
362
[StatusString::DISCARDED , StatusString::ACCEPTED ], 'it ' , [
363
363
'D ' => 'Rifiutato ' ,
364
364
'A ' => 'Accettato ' ,
365
- ],],
365
+ ], ],
366
366
]);
367
367
368
368
it ('can return an associative array of magic translations [value/name => translations] with method name both singular and plural ' , function ($ enumClass , $ cases , $ lang , $ result ) {
383
383
]);
384
384
385
385
it ('throw an TranslationMissing exception ' , function () {
386
- expect (fn () => StatusString::NO_RESPONSE ->notExist ())->toThrow (TranslationMissing::class);
387
- expect (fn () => StatusString::notExists (null , 'it ' ))->toThrow (TranslationMissing::class);
388
- expect (fn () => Status::notExists (null ))->toThrow (TranslationMissing::class);
386
+ expect (fn () => StatusString::NO_RESPONSE ->notExist ())->toThrow (TranslationMissing::class);
387
+ expect (fn () => StatusString::notExists (null , 'it ' ))->toThrow (TranslationMissing::class);
388
+ expect (fn () => Status::notExists (null ))->toThrow (TranslationMissing::class);
389
389
});
390
390
391
391
it ('use a fallback case name if a description translation missing without exception ' , function () {
397
397
'Await decision ' ,
398
398
'Recognized valid ' ,
399
399
'No longer useful ' ,
400
- 'No Response ' // NoResponse humanized
400
+ 'No Response ' , // NoResponse humanized
401
401
])->not ->toThrow (TranslationMissing::class);
402
402
});
403
403
404
-
405
404
it ('use all fallbacks case names for description method if all translations missing without exception ' , function () {
406
405
expect (StatusWithoutTranslations::descriptions ())->toBe ([
407
406
'Pending ' , // PENDING humanized
408
407
'Accepted ' , // ACCEPTED humanized
409
408
'Discarded ' , // DISCARDED humanized
410
- 'No Response ' // NO_RESPONSE humanized
409
+ 'No Response ' , // NO_RESPONSE humanized
411
410
])->not ->toThrow (TranslationMissing::class);
412
- });
411
+ });
0 commit comments