diff --git a/src/Concerns/Internal/SourcePathHelpers.php b/src/Concerns/Internal/SourcePathHelpers.php new file mode 100644 index 00000000..43da80b3 --- /dev/null +++ b/src/Concerns/Internal/SourcePathHelpers.php @@ -0,0 +1,56 @@ +assertEquals( + Hyde::path('_posts'), + Hyde::getModelSourcePath(MarkdownPost::class) + ); + + $this->assertEquals( + Hyde::path('_pages'), + Hyde::getModelSourcePath(MarkdownPage::class) + ); + + $this->assertEquals( + Hyde::path('_docs'), + Hyde::getModelSourcePath(DocumentationPage::class) + ); + + $this->assertEquals( + Hyde::path('_pages'), + Hyde::getModelSourcePath(BladePage::class) + ); + } + + public function test_get_model_source_path_method_returns_path_to_file_for_model_classes() + { + $this->assertEquals( + Hyde::path('_posts'.DIRECTORY_SEPARATOR.'foo.md'), + Hyde::getModelSourcePath(MarkdownPost::class, 'foo.md') + ); + + $this->assertEquals( + Hyde::path('_pages'.DIRECTORY_SEPARATOR.'foo.md'), + Hyde::getModelSourcePath(MarkdownPage::class, 'foo.md') + ); + + $this->assertEquals( + Hyde::path('_docs'.DIRECTORY_SEPARATOR.'foo.md'), + Hyde::getModelSourcePath(DocumentationPage::class, 'foo.md') + ); + + $this->assertEquals( + Hyde::path('_pages'.DIRECTORY_SEPARATOR.'foo.md'), + Hyde::getModelSourcePath(BladePage::class, 'foo.md') + ); + } + + public function test_helper_for_blade_pages() + { + $this->assertEquals( + Hyde::path('_pages'), + Hyde::getBladePagePath() + ); + } + + public function test_helper_for_markdown_pages() + { + $this->assertEquals( + Hyde::path('_pages'), + Hyde::getMarkdownPagePath() + ); + } + + public function test_helper_for_markdown_posts() + { + $this->assertEquals( + Hyde::path('_posts'), + Hyde::getMarkdownPostPath() + ); + } + + public function test_helper_for_documentation_pages() + { + $this->assertEquals( + Hyde::path('_docs'), + Hyde::getDocumentationPagePath() + ); + } +}