-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9690071
commit ee0b04e
Showing
2 changed files
with
36 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
packages/framework/tests/Unit/ConfigurableFeaturesUnitTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Hyde\Facades\Features; | ||
use Illuminate\Support\Facades\Config; | ||
|
||
beforeEach(function () { | ||
$this->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); |