diff --git a/tests/Feature/MetadataHelperTest.php b/tests/Feature/MetadataHelperTest.php deleted file mode 100644 index 44f3b623..00000000 --- a/tests/Feature/MetadataHelperTest.php +++ /dev/null @@ -1,89 +0,0 @@ - []]); - $this->withoutSiteUrl(); - } - - public function testNameMethodReturnsAValidHtmlMetaString() - { - $this->assertEquals( - '', - Meta::name('foo', 'bar') - ); - } - - public function testPropertyMethodReturnsAValidHtmlMetaString() - { - $this->assertEquals( - '', - Meta::property('foo', 'bar') - ); - } - - public function testPropertyMethodAcceptsPropertyWithOgPrefix() - { - $this->assertEquals( - '', - Meta::property('og:foo', 'bar') - ); - } - - public function testPropertyMethodAcceptsPropertyWithoutOgPrefix() - { - $this->assertEquals( - '', - Meta::property('foo', 'bar') - ); - } - - public function testLinkMethodReturnsAValidHtmlLinkString() - { - $this->assertEquals( - '', - Meta::link('foo', 'bar') - ); - } - - public function testLinkMethodReturnsAValidHtmlLinkStringWithAttributes() - { - $this->assertEquals( - '', - Meta::link('foo', 'bar', ['title' => 'baz']) - ); - } - - public function testLinkMethodReturnsAValidHtmlLinkStringWithMultipleAttributes() - { - $this->assertEquals( - '', - Meta::link('foo', 'bar', ['title' => 'baz', 'type' => 'text/css']) - ); - } - - public function testGetMethodReturnsGlobalMetadataBag() - { - $this->assertEquals(Meta::get(), GlobalMetadataBag::make()); - } - - public function testRenderMethodRendersGlobalMetadataBag() - { - $this->assertSame(Meta::render(), GlobalMetadataBag::make()->render()); - } -} diff --git a/tests/Unit/MetaFacadeTest.php b/tests/Unit/MetaFacadeTest.php new file mode 100644 index 00000000..555fc071 --- /dev/null +++ b/tests/Unit/MetaFacadeTest.php @@ -0,0 +1,64 @@ +assertSame('', (string) Meta::name('foo', 'bar')); + } + + public function testPropertyMethodReturnsAValidHtmlMetaString() + { + $this->assertSame('', (string) Meta::property('foo', 'bar')); + } + + public function testPropertyMethodAcceptsPropertyWithOgPrefix() + { + $this->assertSame('', (string) Meta::property('og:foo', 'bar')); + } + + public function testPropertyMethodAcceptsPropertyWithoutOgPrefix() + { + $this->assertSame('', (string) Meta::property('foo', 'bar')); + } + + public function testLinkMethodReturnsAValidHtmlLinkString() + { + $this->assertSame('', (string) Meta::link('foo', 'bar')); + } + + public function testLinkMethodReturnsAValidHtmlLinkStringWithAttributes() + { + $this->assertSame('', (string) Meta::link('foo', 'bar', ['title' => 'baz'])); + } + + public function testLinkMethodReturnsAValidHtmlLinkStringWithMultipleAttributes() + { + $this->assertSame('', (string) Meta::link('foo', 'bar', ['title' => 'baz', 'type' => 'text/css'])); + } + + public function testGetMethodReturnsGlobalMetadataBag() + { + $this->assertEquals(Meta::get(), GlobalMetadataBag::make()); + } + + public function testRenderMethodRendersGlobalMetadataBag() + { + $this->assertSame(Meta::render(), GlobalMetadataBag::make()->render()); + } +} diff --git a/tests/Feature/PageModelConstructorsTest.php b/tests/Unit/PageModelParsingTest.php similarity index 79% rename from tests/Feature/PageModelConstructorsTest.php rename to tests/Unit/PageModelParsingTest.php index ef823b5f..e50175a1 100644 --- a/tests/Feature/PageModelConstructorsTest.php +++ b/tests/Unit/PageModelParsingTest.php @@ -2,13 +2,12 @@ declare(strict_types=1); -namespace Hyde\Framework\Testing\Feature; +namespace Hyde\Framework\Testing\Unit; -use Hyde\Facades\Filesystem; -use Hyde\Hyde; +use Hyde\Testing\UnitTestCase; use Hyde\Pages\DocumentationPage; use Hyde\Pages\MarkdownPage; -use Hyde\Testing\TestCase; +use Hyde\Testing\CreatesTemporaryFiles; /** * Test the constructor actions and schema constructors for page models. @@ -19,8 +18,18 @@ * @covers \Hyde\Framework\Factories\HydePageDataFactory * @covers \Hyde\Framework\Factories\BlogPostDataFactory */ -class PageModelConstructorsTest extends TestCase +class PageModelParsingTest extends UnitTestCase { + use CreatesTemporaryFiles; + + protected static bool $needsKernel = true; + protected static bool $needsConfig = true; + + protected function tearDown(): void + { + $this->cleanUpFilesystem(); + } + public function testDynamicDataConstructorCanFindTitleFromFrontMatter() { $this->markdown('_pages/foo.md', '# Foo Bar', ['title' => 'My Title']); @@ -55,13 +64,10 @@ public function testDocumentationPageParserCanGetGroupFromFrontMatter() public function testDocumentationPageParserCanGetGroupAutomaticallyFromNestedPage() { - mkdir(Hyde::path('_docs/foo')); - touch(Hyde::path('_docs/foo/bar.md')); + $this->directory('_docs/foo'); + $this->file('_docs/foo/bar.md'); $page = DocumentationPage::parse('foo/bar'); $this->assertSame('foo', $page->navigationMenuGroup()); - - Filesystem::unlink('_docs/foo/bar.md'); - rmdir(Hyde::path('_docs/foo')); } }