diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/HirdTest.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/HirdTest.php b/tests/HirdTest.php index 9e49467..35f4895 100644 --- a/tests/HirdTest.php +++ b/tests/HirdTest.php @@ -88,3 +88,21 @@ test('Validate an incorrect correct date format', function () { 'date does not match the required date format Y-m-d H:i:s.', ]); }); + +test('Validate using a overwritten field name', function () { + $fields = ['date' => '2020-09-17 15:00']; + $fieldNames = ['date' => 'Date']; + $rules = ['date' => 'date-format:Y-m-d H:i:s']; + + $hird = new Hird( + fields: $fields, + rules: $rules, + fieldNames: $fieldNames + ); + + $hird->fails(); + + expect($hird->errors())->toBe([ + 'Date does not match the required date format Y-m-d H:i:s.', + ]); +}); |
