Skip to content

Commit

Permalink
Test path helpers return same result as fluent filesystem helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Nov 12, 2022
1 parent d1fc9ea commit f641cb7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/framework/tests/Feature/HydePageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,22 @@ public function testGetLinkUsesHyperlinksHelper()
);
}

public function test_path_helpers_return_same_result_as_fluent_filesystem_helpers()
{
$this->assertSameIgnoringDirSeparatorType(BladePage::path('foo'), Hyde::getBladePagePath('foo'));
$this->assertSameIgnoringDirSeparatorType(MarkdownPage::path('foo'), Hyde::getMarkdownPagePath('foo'));
$this->assertSameIgnoringDirSeparatorType(MarkdownPost::path('foo'), Hyde::getMarkdownPostPath('foo'));
$this->assertSameIgnoringDirSeparatorType(DocumentationPage::path('foo'), Hyde::getDocumentationPagePath('foo'));
}

protected function assertSameIgnoringDirSeparatorType(string $expected, string $actual): void
{
$this->assertSame(
str_replace('\\', '/', $expected),
str_replace('\\', '/', $actual)
);
}

protected function resetDirectoryConfiguration(): void
{
BladePage::$sourceDirectory = '_pages';
Expand Down

0 comments on commit f641cb7

Please sign in to comment.