Skip to content

Commit a6c5ba0

Browse files
committed
Test extra YAML navigation item fields are ignored
1 parent 74240c0 commit a6c5ba0

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

packages/framework/tests/Feature/YamlConfigurationFeatureTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,37 @@ public function testNavigationItemsInTheYamlConfigCanBeResolvedToRoutes()
583583
$this->assertSame(250, $navigationItems[1]->getPriority());
584584
}
585585

586+
public function testExtraYamlNavigationItemFieldsAreIgnored()
587+
{
588+
$this->file('hyde.yml', <<<'YAML'
589+
hyde:
590+
navigation:
591+
custom:
592+
- destination: 'about'
593+
extra: 'field'
594+
YAML);
595+
596+
$this->runBootstrappers();
597+
598+
$configItems = config('hyde.navigation.custom');
599+
600+
$this->assertSame([
601+
[
602+
'destination' => 'about',
603+
'label' => null,
604+
'priority' => null,
605+
],
606+
], $configItems);
607+
608+
$navigationItems = NavigationMenuGenerator::handle(MainNavigationMenu::class)->getItems()->all();
609+
610+
$this->assertCount(2, $navigationItems);
611+
612+
$this->assertSame('about', $navigationItems[1]->getLink());
613+
$this->assertSame('about', $navigationItems[1]->getLabel());
614+
$this->assertSame(500, $navigationItems[1]->getPriority());
615+
}
616+
586617
public function testTypeErrorsInNavigationYamlConfigAreRethrownMoreHelpfully()
587618
{
588619
file_put_contents('hyde.yml', <<<'YAML'

0 commit comments

Comments
 (0)