-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
Showing
7 changed files
with
80 additions
and
39 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
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
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
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
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
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
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,55 @@ | ||
<?php | ||
|
||
/** | ||
* We don't care for unhandled exceptions in tests. | ||
* It is the nature of a test to throw an exception. | ||
* Without this suppression we had 100+ Linter warning in this file which | ||
* don't help anything. | ||
* | ||
* @noinspection PhpDocMissingThrowsInspection | ||
* @noinspection PhpUnhandledExceptionInspection | ||
*/ | ||
|
||
namespace Tests\Unit; | ||
|
||
use App\Assets\Features; | ||
use App\Exceptions\Internal\FeaturesDoesNotExistsException; | ||
use Tests\AbstractTestCase; | ||
|
||
class FeaturesUnitTest extends AbstractTestCase | ||
{ | ||
public function testAllAreActive(): void | ||
{ | ||
$this->assertFalse(Features::allAreActive(['use-s3'])); | ||
$this->assertTrue(Features::allAreActive(['vuejs'])); | ||
} | ||
|
||
public function testSomeAreActive(): void | ||
{ | ||
$this->assertFalse(Features::someAreActive(['use-s3'])); | ||
$this->assertTrue(Features::someAreActive(['vuejs', 'use-s3'])); | ||
} | ||
|
||
public function testAllAreInactive(): void | ||
{ | ||
$this->assertTrue(Features::allAreInactive(['use-s3'])); | ||
$this->assertFalse(Features::allAreInactive(['vuejs'])); | ||
} | ||
|
||
public function testSomeAreInactive(): void | ||
{ | ||
$this->assertFalse(Features::someAreInactive(['vuejs'])); | ||
$this->assertTrue(Features::someAreInactive(['vuejs', 'use-s3'])); | ||
} | ||
|
||
public function testWhenArray(): void | ||
{ | ||
$this->assertTrue(Features::when(['vuejs'], fn () => true, fn () => false)); | ||
} | ||
|
||
public function testThrow(): void | ||
{ | ||
$this->expectException(FeaturesDoesNotExistsException::class); | ||
Features::active('livewire'); | ||
} | ||
} |