diff --git a/packages/framework/tests/Feature/ConfigurableFeaturesTest.php b/packages/framework/tests/Feature/ConfigurableFeaturesTest.php index d263490c042..1734af8c6a9 100644 --- a/packages/framework/tests/Feature/ConfigurableFeaturesTest.php +++ b/packages/framework/tests/Feature/ConfigurableFeaturesTest.php @@ -14,31 +14,6 @@ */ class ConfigurableFeaturesTest extends TestCase { - public function testHasHtmlPagesReturnsFalseWhenFeatureIsNotEnabled() - { - $this->expectMethodReturnsFalse('hasHtmlPages'); - } - - public function testHasBladePagesReturnsFalseWhenFeatureIsNotEnabled() - { - $this->expectMethodReturnsFalse('hasBladePages'); - } - - public function testHasMarkdownPagesReturnsFalseWhenFeatureIsNotEnabled() - { - $this->expectMethodReturnsFalse('hasMarkdownPages'); - } - - public function testHasMarkdownPostsReturnsFalseWhenFeatureIsNotEnabled() - { - $this->expectMethodReturnsFalse('hasMarkdownPosts'); - } - - public function testHasDocumentationPagesReturnsFalseWhenFeatureIsNotEnabled() - { - $this->expectMethodReturnsFalse('hasDocumentationPages'); - } - public function testHasDocumentationSearchReturnsFalseWhenFeatureIsNotEnabled() { $this->expectMethodReturnsFalse('hasDocumentationSearch'); @@ -59,31 +34,6 @@ public function testHasRssReturnsFalseWhenFeatureIsNotEnabled() $this->expectMethodReturnsFalse('hasRss'); } - public function testHasHtmlPagesReturnsTrueWhenFeatureIsEnabled() - { - $this->expectMethodReturnsTrue('hasHtmlPages'); - } - - public function testHasBladePagesReturnsTrueWhenFeatureIsEnabled() - { - $this->expectMethodReturnsTrue('hasBladePages'); - } - - public function testHasMarkdownPagesReturnsTrueWhenFeatureIsEnabled() - { - $this->expectMethodReturnsTrue('hasMarkdownPages'); - } - - public function testHasMarkdownPostsReturnsTrueWhenFeatureIsEnabled() - { - $this->expectMethodReturnsTrue('hasMarkdownPosts'); - } - - public function testHasDocumentationPagesReturnsTrueWhenFeatureIsEnabled() - { - $this->expectMethodReturnsTrue('hasDocumentationPages'); - } - public function testHasDarkmodeReturnsTrueWhenFeatureIsEnabled() { $this->expectMethodReturnsTrue('hasDarkmode'); diff --git a/packages/framework/tests/Unit/ConfigurableFeaturesUnitTest.php b/packages/framework/tests/Unit/ConfigurableFeaturesUnitTest.php new file mode 100644 index 00000000000..3cd0d58ab48 --- /dev/null +++ b/packages/framework/tests/Unit/ConfigurableFeaturesUnitTest.php @@ -0,0 +1,37 @@ +mockConfig(); + $this->needsKernel(); +}); + +test('expect has method returns false when feature is disabled', function (string $method) { + Config::set('hyde.features', []); + + $this->assertFalse(Features::$method(), "Method '$method' should return false when feature is not enabled"); +})->with([ + 'hasHtmlPages', + 'hasBladePages', + 'hasMarkdownPages', + 'hasMarkdownPosts', + 'hasDocumentationPages', +])->covers(Hyde\Facades\Features::class); + + +test('expect has method returns true when feature is enabled', function (string $method) { + Config::set('hyde.features', [str($method)->kebab()->replace('has-', '')->toString()]); + \Hyde\Foundation\HydeKernel::setInstance(new \Hyde\Foundation\HydeKernel()); + + $this->assertTrue(Features::$method(), "Method '$method' should return true when feature is enabled"); +})->with([ + 'hasHtmlPages', + 'hasBladePages', + 'hasMarkdownPages', + 'hasMarkdownPosts', + 'hasDocumentationPages', +])->covers(Hyde\Facades\Features::class);