diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 599dcd1e614..011f4567940 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -10,7 +10,7 @@ This serves two purposes: 2. At release time, you can move the Unreleased section changes into a new release version section. ### Added -- Add experimental `InMemoryPage::getOutputPath` overload support +- for new features. ### Changed - Changed how the documentation search is generated, to be an `InMemoryPage` instead of a post-build task. diff --git a/packages/framework/src/Pages/InMemoryPage.php b/packages/framework/src/Pages/InMemoryPage.php index 56a429344e2..541e9356ec9 100644 --- a/packages/framework/src/Pages/InMemoryPage.php +++ b/packages/framework/src/Pages/InMemoryPage.php @@ -82,16 +82,6 @@ public function getBladeView(): string return $this->view; } - /** @experimental Get the path to the output file for the page. */ - public function getOutputPath(): string - { - if ($this->hasMacro('getOutputPath')) { - return $this->__call('getOutputPath', []); - } - - return parent::getOutputPath(); - } - /** * Get the contents that will be saved to disk for this page. * diff --git a/packages/framework/tests/Feature/Commands/BuildSearchCommandTest.php b/packages/framework/tests/Feature/Commands/BuildSearchCommandTest.php index 9562ae12512..2ba0891886e 100644 --- a/packages/framework/tests/Feature/Commands/BuildSearchCommandTest.php +++ b/packages/framework/tests/Feature/Commands/BuildSearchCommandTest.php @@ -9,6 +9,7 @@ use Hyde\Pages\InMemoryPage; use Hyde\Pages\DocumentationPage; use Hyde\Testing\TestCase; +use Hyde\Framework\Features\Documentation\DocumentationSearchIndex; /** * @covers \Hyde\Console\Commands\BuildSearchCommand @@ -107,10 +108,7 @@ public function test_search_files_can_be_generated_for_custom_site_and_nested_do public function test_command_uses_search_pages_from_kernel_when_present() { - Hyde::pages()->addPage(tap(new InMemoryPage('docs/search.json'), function (InMemoryPage $page): void { - $page->macro('compile', fn () => '{"foo":"bar"}'); - $page->macro('getOutputPath', fn () => 'docs/search.json'); - })); + Hyde::pages()->addPage(new SearchIndexOverrideTestPage()); Hyde::pages()->addPage(tap(new InMemoryPage('docs/search'), function (InMemoryPage $page): void { $page->macro('compile', fn () => 'Foo'); @@ -128,3 +126,16 @@ public function test_command_uses_search_pages_from_kernel_when_present() // Filesystem::unlink('_site/docs/search.html'); } } + +class SearchIndexOverrideTestPage extends DocumentationSearchIndex +{ + public function compile(): string + { + return '{"foo":"bar"}'; + } + + public function getOutputPath(): string + { + return 'docs/search.json'; + } +}