Skip to content

Commit

Permalink
add NotRequiredWithRule for conditional validation
Browse files Browse the repository at this point in the history
  • Loading branch information
BlakvGhost committed May 18, 2024
1 parent 832058f commit 5ec352c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/Feature/RuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,12 @@

it('validates not_required_with rule successfully', function () {

$validator = new Validator(['field' => 'value', 'other_field' => 'value2'], ['field' => 'not_required_with:other_field']);
expect($validator->isValid())->toBeFalse();

$validator = new Validator(['field' => 'value'], ['field' => 'not_required_with:other_field']);
expect($validator->isValid())->toBeTrue();

$validator = new Validator(['field' => 'value', 'other_field' => 'value2'], ['field' => 'not_required_with:other_field']);
expect($validator->isValid())->toBeFalse();

expect($validator->getErrors()['field'][0])->toBe(
LangManager::getTranslation('validation.not_required_with', [
'attribute' => 'field',
Expand Down

0 comments on commit 5ec352c

Please sign in to comment.