|
8 | 8 | use Illuminate\Support\Env; |
9 | 9 | use Hyde\Framework\Features\Navigation\NavigationItem; |
10 | 10 | use Hyde\Framework\Features\Blogging\Models\PostAuthor; |
| 11 | +use Hyde\Framework\Features\Navigation\MainNavigationMenu; |
11 | 12 | use Hyde\Framework\Exceptions\InvalidConfigurationException; |
| 13 | +use Hyde\Framework\Features\Navigation\NavigationMenuGenerator; |
12 | 14 |
|
13 | 15 | /** |
14 | 16 | * Test the Yaml configuration feature. |
@@ -476,22 +478,45 @@ public function testCanSetCustomNavigationItemsInTheYamlConfig() |
476 | 478 |
|
477 | 479 | $this->runBootstrappers(); |
478 | 480 |
|
479 | | - $navigationItems = config('hyde.navigation.custom'); |
| 481 | + $configItems = config('hyde.navigation.custom'); |
480 | 482 |
|
481 | | - $this->assertCount(3, $navigationItems); |
| 483 | + $this->assertSame([ |
| 484 | + [ |
| 485 | + 'destination' => 'https://example.com', |
| 486 | + 'label' => 'Example', |
| 487 | + 'priority' => 100, |
| 488 | + ], [ |
| 489 | + 'destination' => 'about', |
| 490 | + 'label' => 'About Us', |
| 491 | + 'priority' => 200, |
| 492 | + ], [ |
| 493 | + 'destination' => 'contact', |
| 494 | + 'label' => 'Contact', |
| 495 | + 'priority' => 300, |
| 496 | + ], |
| 497 | + ], $configItems); |
| 498 | + |
| 499 | + /** @var NavigationItem[] $navigationItems */ |
| 500 | + $navigationItems = NavigationMenuGenerator::handle(MainNavigationMenu::class)->getItems()->all(); |
| 501 | + |
| 502 | + $this->assertCount(4, $navigationItems); |
482 | 503 | $this->assertContainsOnlyInstancesOf(NavigationItem::class, $navigationItems); |
483 | 504 |
|
484 | | - $this->assertSame('https://example.com', $navigationItems[0]->destination); |
485 | | - $this->assertSame('Example', $navigationItems[0]->label); |
486 | | - $this->assertSame(100, $navigationItems[0]->priority); |
| 505 | + $this->assertSame('index.html', $navigationItems[0]->getLink()); |
| 506 | + $this->assertSame('Home', $navigationItems[0]->getLabel()); |
| 507 | + $this->assertSame(0, $navigationItems[0]->getPriority()); |
| 508 | + |
| 509 | + $this->assertSame('https://example.com', $navigationItems[1]->getLink()); |
| 510 | + $this->assertSame('Example', $navigationItems[1]->getLabel()); |
| 511 | + $this->assertSame(100, $navigationItems[1]->getPriority()); |
487 | 512 |
|
488 | | - $this->assertSame('about', $navigationItems[1]->destination); |
489 | | - $this->assertSame('About Us', $navigationItems[1]->label); |
490 | | - $this->assertSame(200, $navigationItems[1]->priority); |
| 513 | + $this->assertSame('about', $navigationItems[2]->getLink()); |
| 514 | + $this->assertSame('About Us', $navigationItems[2]->getLabel()); |
| 515 | + $this->assertSame(200, $navigationItems[2]->getPriority()); |
491 | 516 |
|
492 | | - $this->assertSame('contact', $navigationItems[2]->destination); |
493 | | - $this->assertSame('Contact', $navigationItems[2]->label); |
494 | | - $this->assertSame(300, $navigationItems[2]->priority); |
| 517 | + $this->assertSame('contact', $navigationItems[3]->getLink()); |
| 518 | + $this->assertSame('Contact', $navigationItems[3]->getLabel()); |
| 519 | + $this->assertSame(300, $navigationItems[3]->getPriority()); |
495 | 520 | } |
496 | 521 |
|
497 | 522 | protected function runBootstrappers(?array $withMergedConfig = null): void |
|
0 commit comments