Skip to content

Commit

Permalink
Test all pages are routable
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Nov 18, 2022
1 parent 4b9420d commit d525f69
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/framework/tests/Feature/HydePageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,34 @@ public function test_path_helpers_return_same_result_as_fluent_filesystem_helper
$this->assertSameIgnoringDirSeparatorType(DocumentationPage::path('foo'), Hyde::getDocumentationPagePath('foo'));
}

public function test_all_pages_are_routable()
{
$pages = [
BladePage::class,
MarkdownPage::class,
MarkdownPost::class,
DocumentationPage::class,
HtmlPage::class,
];

/** @var HydePage $page */
foreach ($pages as $page) {
$page = new $page('foo');

$this->assertInstanceOf(Route::class, $page->getRoute());
$this->assertEquals(new Route($page), $page->getRoute());
$this->assertSame($page->getRoute()->getLink(), $page->getLink());

Hyde::touch($page::sourcePath('foo'));
Hyde::boot();

$this->assertArrayHasKey($page->getSourcePath(), Hyde::pages());
$this->assertArrayHasKey($page->getRouteKey(), Hyde::routes());

unlink($page::sourcePath('foo'));
}
}

protected function assertSameIgnoringDirSeparatorType(string $expected, string $actual): void
{
$this->assertSame(
Expand Down

0 comments on commit d525f69

Please sign in to comment.