fix: keep menu items in parent cycles, tighten menu write tests
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -34,4 +34,21 @@ final class MenuTreeTest extends TestCase
|
||||
|
||||
self::assertSame(['Waise', 'Zirkel'], array_column($tree, 'title'));
|
||||
}
|
||||
|
||||
public function testParentNotPresentInTheMenuLandsOnTheTopLevel(): void
|
||||
{
|
||||
$tree = MenuTree::build([self::item(40, 12345, 'Verwaist')]);
|
||||
|
||||
self::assertSame(['Verwaist'], array_column($tree, 'title'));
|
||||
self::assertSame([], $tree[0]['children']);
|
||||
}
|
||||
|
||||
public function testATwoNodeParentCycleKeepsBothItemsOnTheTopLevel(): void
|
||||
{
|
||||
$tree = MenuTree::build([self::item(30, 31, 'A'), self::item(31, 30, 'B')]);
|
||||
|
||||
self::assertSame(['A', 'B'], array_column($tree, 'title'));
|
||||
self::assertSame([], $tree[0]['children']);
|
||||
self::assertSame([], $tree[1]['children']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user