Skip to content

Commit aded2d7

Browse files
committed
test: add unit tests for required_without with multiple dot-path fields
1 parent 39badf8 commit aded2d7

1 file changed

Lines changed: 1 addition & 20 deletions

File tree

tests/system/Validation/ValidationTest.php

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,15 +1854,6 @@ public function testRequireWithoutWithAsterisk(): void
18541854
);
18551855
}
18561856

1857-
/**
1858-
* @see https://github.com/codeigniter4/CodeIgniter4/issues/5942
1859-
*
1860-
* Tests that required_without with MULTIPLE dot-path fields
1861-
* properly checks ALL fields, not just the first one.
1862-
*
1863-
* The old bug: return inside foreach caused only the first
1864-
* field (a.*.b) to be checked. The second (a.*.d) was ignored.
1865-
*/
18661857
public function testRequireWithoutWithMultipleAsterisk(): void
18671858
{
18681859
$data = [
@@ -1885,21 +1876,11 @@ public function testRequireWithoutWithMultipleAsterisk(): void
18851876
$this->assertArrayHasKey('a.2.c', $this->validation->getErrors(), 'Row 2: c missing, d missing → field required');
18861877
}
18871878

1888-
/**
1889-
* @see https://github.com/codeigniter4/CodeIgniter4/issues/5942
1890-
*
1891-
* Tests that required_without with multiple dot-path fields
1892-
* correctly fails when the LAST field (a.*.nonexistent) is
1893-
* missing, while the first field (a.*.b) is present.
1894-
*
1895-
* The old bug: return after checking a.*.b would exit the
1896-
* foreach early, ignoring a.*.nonexistent entirely.
1897-
*/
18981879
public function testRequireWithoutWithMultipleAsteriskLastMissing(): void
18991880
{
19001881
$data = [
19011882
'a' => [
1902-
['b' => 1, 'c' => ''], // c empty, b present, nonexistent missing
1883+
['b' => 1, 'c' => ''],
19031884
],
19041885
];
19051886

0 commit comments

Comments
 (0)