We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2e62c82 commit 2a751c6Copy full SHA for 2a751c6
1 file changed
tests/system/Validation/ValidationTest.php
@@ -1443,4 +1443,26 @@ public function testRuleWithLeadingAsterisk(): void
1443
$this->assertFalse($this->validation->run($data));
1444
$this->assertSame('Required *.foo', $this->validation->getError('*.foo'));
1445
}
1446
+
1447
+ /**
1448
+ * @see https://github.com/codeigniter4/CodeIgniter4/issues/5942
1449
+ */
1450
+ public function testRequireWithoutWithWildCard()
1451
+ {
1452
+ $data = [
1453
+ 'a' => [
1454
+ ['b' => 1, 'c' => 2],
1455
+ ['c' => ''],
1456
+ ],
1457
+ ];
1458
1459
+ $this->validation->setRules([
1460
+ 'a.*.c' => 'required_without[a.*.b]',
1461
+ ])->run($data);
1462
1463
+ $this->assertSame(
1464
+ 'The a.*.c field is required when a.*.b is not present.',
1465
+ $this->validation->getError('a.1.c')
1466
+ );
1467
+ }
1468
0 commit comments