Skip to content

Commit

Permalink
Revert "Add experimental InMemoryPage::getOutputPath overload support"
Browse files Browse the repository at this point in the history
This reverts commit 697e016. See https://github.com/hydephp/develop/pull/1498/files#r1429894023

Also updates a test to use a test class instead of using the macro (which was it's only current usage)
  • Loading branch information
caendesilva committed Dec 18, 2023
1 parent b7a2537 commit 2d46f6b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 0 additions & 10 deletions packages/framework/src/Pages/InMemoryPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');
Expand All @@ -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';
}
}

0 comments on commit 2d46f6b

Please sign in to comment.