Skip to content

Commit 3979fa8

Browse files
committed
Update constructor to use the same logic as the static create method
1 parent 12925d3 commit 3979fa8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/framework/tests/Unit/NavigationItemTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ public function testPassingRouteInstanceToConstructorUsesRouteInstance()
5151
$this->assertEquals($route, (new NavigationItem($route, 'Home'))->getPage()->getRoute());
5252
}
5353

54-
public function testPassingRouteKeyToConstructorUsesDestinationAsLink()
54+
public function testPassingRouteKeyToConstructorUsesDestinationAsRoute()
5555
{
5656
$item = new NavigationItem('index', 'Home');
57-
$this->assertNull($item->getPage());
58-
$this->assertSame('index', $item->getLink());
57+
$this->assertSame(Routes::get('index')->getPage(), $item->getPage());
58+
$this->assertSame('index', $item->getPage()->getRouteKey());
59+
$this->assertSame('index.html', $item->getLink());
5960
}
6061

6162
public function testPassingUrlToConstructorSetsRouteToNull()

0 commit comments

Comments
 (0)