Skip to content

Commit

Permalink
test: update failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Nov 4, 2024
1 parent c8d8090 commit 6d72c3e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/rules.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@
return $value === 'custom';
});

expect(validator()->validateRule('anotherCustomRule', 'custom'))->toBe(true);
expect(validator()->validateRule('anotherCustomRule', 'not custom'))->toBe(false);
$data = [
'item1' => 'custom',
'item2' => 'not custom',
];

expect(validator()->validate($data, ['item1' => 'anotherCustomRule']))->toBe($data);
expect(validator()->validate($data, ['item2' => 'anotherCustomRule']))->toBe(false);
expect(validator()->errors())->toHaveKey('item2');
});

test('can add custom validation rules with closure and custom message', function () {
Expand Down

0 comments on commit 6d72c3e

Please sign in to comment.