-
Notifications
You must be signed in to change notification settings - Fork 2k
fix: validation custom error with asterisk field #6352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
c0a782b
340c752
9fc2b7a
4441fd1
23d71d6
f1db96b
4a6527a
a8453e2
3648faa
4632602
cb71f73
01dac95
1be14e7
d77883e
9c0c695
68ad806
55f3c23
dc84e94
ab6aa3c
a42651b
b2aac31
d75dabd
fa50250
d8fe98d
b667425
db1833a
d0f0881
23a18eb
776926f
b471880
09bcef4
416da02
2da8ef8
d4b0483
6d51b2c
4511b3f
cf662be
1086703
4fdffaa
9204889
cb7b565
7c12af8
6d3a24b
34a1f5b
f9d93ce
00c6596
eb6e943
fe010ba
dba4bee
713d6bb
748bad7
3320fdb
c5d8cb2
9bdf852
3b9e662
fa442b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -359,6 +359,28 @@ public function testRunGroupWithCustomErrorMessage(): void | |
], $this->validation->getErrors()); | ||
} | ||
|
||
/** | ||
* @see https://github.com/codeigniter4/CodeIgniter4/issues/6245 | ||
*/ | ||
public function testRunWithCustomErrorsAndAsteriskField(): void | ||
{ | ||
$data = [ | ||
'foo' => [ | ||
['bar' => null], | ||
['bar' => null], | ||
], | ||
]; | ||
$this->validation->setRules( | ||
['foo.*.bar' => ['label' => 'foo bar', 'rules' => 'required']], | ||
['foo.*.bar' => ['required' => 'Required']] | ||
); | ||
$this->validation->run($data); | ||
$this->assertSame([ | ||
'foo.0.bar' => 'Required', | ||
'foo.1.bar' => 'Required', | ||
Comment on lines
+379
to
+380
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you really okay with key like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But as I known, validation service change the asterisk field to like |
||
], $this->validation->getErrors()); | ||
} | ||
|
||
/** | ||
* @dataProvider rulesSetupProvider | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.