diff --git a/src/Directives/WordPress.php b/src/Directives/WordPress.php index 1622f01..de08c58 100644 --- a/src/Directives/WordPress.php +++ b/src/Directives/WordPress.php @@ -631,6 +631,24 @@ public function directives(): array return ""; }, + + /* + |--------------------------------------------------------------------- + | @menu / @hasmenu / @endhasmenu + |--------------------------------------------------------------------- + */ + + 'menu' => function ($expression) { + return ""; + }, + + 'hasmenu' => function ($expression) { + return ""; + }, + + 'endhasmenu' => function () { + return ''; + }, ]; } } diff --git a/tests/Unit/WordPressTest.php b/tests/Unit/WordPressTest.php index 0b347d0..30a230f 100644 --- a/tests/Unit/WordPressTest.php +++ b/tests/Unit/WordPressTest.php @@ -845,3 +845,33 @@ expect($compiled)->toBe(""); }); }); + +describe('@menu', function () { + it('compiles correctly', function () { + $directive = "@menu(['theme_location' => 'primary_navigation'])"; + + $compiled = $this->compile($directive); + + expect($compiled)->toBe(" 'primary_navigation']); ?>"); + }); +}); + +describe('@hasmenu', function () { + it('compiles correctly', function () { + $directive = "@hasmenu('primary_navigation')"; + + $compiled = $this->compile($directive); + + expect($compiled)->toBe(""); + }); +}); + +describe('@endhasmenu', function () { + it('compiles correctly', function () { + $directive = '@endhasmenu'; + + $compiled = $this->compile($directive); + + expect($compiled)->toBe(''); + }); +});