diff --git a/tests/validation.test.php b/tests/validation.test.php index 65b01f7..4900ff3 100644 --- a/tests/validation.test.php +++ b/tests/validation.test.php @@ -60,3 +60,12 @@ expect($validatedData)->toBe(false); expect(Form::errors())->toHaveKey('test5'); }); + +test('optional rule works correctly no matter it\'s position', function () { + $itemsToValidate = []; + + $validatedData = Form::validate($itemsToValidate, ['test6' => 'text|email|optional']); + + expect($validatedData)->toBe($itemsToValidate); + expect(Form::errors())->not()->toHaveKey('test6'); +});