Skip to content

Commit 86ecc5c

Browse files
committed
test: add optional test
1 parent 2bc65ee commit 86ecc5c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/validation.test.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,12 @@
6060
expect($validatedData)->toBe(false);
6161
expect(Form::errors())->toHaveKey('test5');
6262
});
63+
64+
test('optional rule works correctly no matter it\'s position', function () {
65+
$itemsToValidate = [];
66+
67+
$validatedData = Form::validate($itemsToValidate, ['test6' => 'text|email|optional']);
68+
69+
expect($validatedData)->toBe($itemsToValidate);
70+
expect(Form::errors())->not()->toHaveKey('test6');
71+
});

0 commit comments

Comments
 (0)