Skip to content

Commit

Permalink
Inline GeneratesMainNavigationMenu::handle method
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Feb 21, 2024
1 parent e06f1c0 commit eb5d79e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

use Hyde\Foundation\HydeKernel;
use Illuminate\Support\ServiceProvider;
use Hyde\Framework\Features\Navigation\NavigationMenu;
use Hyde\Framework\Features\Navigation\NavigationManager;
use Hyde\Framework\Features\Navigation\DocumentationSidebar;
use Hyde\Framework\Features\Navigation\NavigationMenuGenerator;
use Hyde\Framework\Features\Navigation\GeneratesMainNavigationMenu;

class NavigationServiceProvider extends ServiceProvider
{
Expand All @@ -22,7 +22,7 @@ public function register(): void
$this->app->alias(NavigationManager::class, 'navigation');

$this->app->make(HydeKernel::class)->booted(function () {
$this->app->make(NavigationManager::class)->registerMenu('main', GeneratesMainNavigationMenu::handle());
$this->app->make(NavigationManager::class)->registerMenu('main', NavigationMenuGenerator::handle(NavigationMenu::class));
$this->app->make(NavigationManager::class)->registerMenu('sidebar', NavigationMenuGenerator::handle(DocumentationSidebar::class));
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@
*/
class GeneratesMainNavigationMenu
{
public static function handle(): NavigationMenu
{
return NavigationMenuGenerator::handle(NavigationMenu::class);
}
//
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
use Illuminate\Support\Collection;
use Hyde\Foundation\Kernel\RouteCollection;
use Hyde\Framework\Features\Navigation\NavItem;
use Hyde\Framework\Features\Navigation\NavigationMenu;
use Hyde\Framework\Features\Navigation\DocumentationSidebar;
use Hyde\Framework\Features\Navigation\NavigationMenuGenerator;
use Hyde\Framework\Features\Navigation\GeneratesMainNavigationMenu;

/**
* High-level broad-spectrum tests for the automatic navigation configurations, testing various setups.
Expand Down Expand Up @@ -1248,7 +1248,7 @@ public function __construct(TestCase $test, $sidebar = false)
{
$this->items = $sidebar
? NavigationMenuGenerator::handle(DocumentationSidebar::class)->getItems()
: GeneratesMainNavigationMenu::handle()->getItems();
: NavigationMenuGenerator::handle(NavigationMenu::class)->getItems();

$this->test = $test;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/framework/tests/Feature/NavigationMenuTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Hyde\Pages\MarkdownPage;
use Hyde\Testing\TestCase;
use Illuminate\Support\Collection;
use Hyde\Framework\Features\Navigation\GeneratesMainNavigationMenu;
use Hyde\Framework\Features\Navigation\NavigationMenuGenerator;

/**
* @covers \Hyde\Framework\Features\Navigation\GeneratesMainNavigationMenu
Expand Down Expand Up @@ -271,6 +271,6 @@ public function testCanAddItemsToMainNavigationMenuResolvedFromContainer()

protected function createNavigationMenu(): NavigationMenu
{
return GeneratesMainNavigationMenu::handle();
return NavigationMenuGenerator::handle(NavigationMenu::class);
}
}

0 comments on commit eb5d79e

Please sign in to comment.