Skip to content

Commit 0937cb7

Browse files
committed
test: Refactor assertion loop for verifying children order in tree traversal.
1 parent 4655cb0 commit 0937cb7

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

tests/NestedSetsBehaviorTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,12 +2316,12 @@ public function testChildrenMethodRequiresOrderByForCorrectTreeTraversal(): void
23162316
'Children list should contain exactly 3 elements.',
23172317
);
23182318

2319-
for ($i = 0; $i < 3; $i++) {
2320-
if (isset($childrenList[$i]) === true) {
2319+
foreach ($childrenList as $index => $child) {
2320+
if (isset($expectedOrder[$index])) {
23212321
self::assertEquals(
2322-
$expectedOrder[$i],
2323-
$childrenList[$i]->getAttribute('name'),
2324-
"Child at index {$i} should be {$expectedOrder[$i]} in correct \'lft\' order.",
2322+
$expectedOrder[$index],
2323+
$child->getAttribute('name'),
2324+
"Child at index {$index} should be {$expectedOrder[$index]} in correct \'lft\' order.",
23252325
);
23262326
}
23272327
}

0 commit comments

Comments
 (0)