Skip to content

Commit

Permalink
test: add condition to follow required_without[] rule.
Browse files Browse the repository at this point in the history
  • Loading branch information
ping-yee committed Sep 27, 2022
1 parent 0cb72e0 commit 0b0eb24
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/system/Validation/ValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1414,13 +1414,20 @@ public function testNestedArrayThrowsException(): void
'credit_amount' => null,
'purpose' => 'A',
],
'account_3' => [
'account_number' => '',
'credit_amount' => 2000,
'purpose' => '',
],
],
];
$this->validation->run($data);

$this->assertSame([
'beneficiaries_accounts.account_2.credit_amount' => 'The CREDIT AMOUNT field is required.',
'beneficiaries_accounts.account_2.purpose' => 'The PURPOSE field must be at least 3 characters in length.',
'beneficiaries_accounts.account_3.account_number' => 'The BENEFICIARY ACCOUNT NUMBER field must be exactly 5 characters in length.',
'beneficiaries_accounts.account_2.credit_amount' => 'The CREDIT AMOUNT field is required.',
'beneficiaries_accounts.account_2.purpose' => 'The PURPOSE field must be at least 3 characters in length.',
'beneficiaries_accounts.account_3.purpose' => 'The PURPOSE field is required when BENEFICIARY ACCOUNT NUMBER is not present.',
], $this->validation->getErrors());
}

Expand Down

0 comments on commit 0b0eb24

Please sign in to comment.