-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
48 additions
and
0 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
36 changes: 36 additions & 0 deletions
36
tests/E2E/PHPUnit/CheckClassWithMultipleExpressionsTest.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); | ||
|
||
namespace Arkitect\Tests\E2E\PHPUnit; | ||
|
||
use Arkitect\ClassSet; | ||
use Arkitect\Expression\ForClasses\IsNotAbstract; | ||
use Arkitect\Expression\ForClasses\IsNotEnum; | ||
use Arkitect\Expression\ForClasses\IsNotFinal; | ||
use Arkitect\Expression\ForClasses\IsNotInterface; | ||
use Arkitect\Expression\ForClasses\IsNotReadonly; | ||
use Arkitect\Expression\ForClasses\IsNotTrait; | ||
use Arkitect\Expression\ForClasses\ResideInOneOfTheseNamespaces; | ||
use Arkitect\Rules\Rule; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class CheckClassWithMultipleExpressionsTest extends TestCase | ||
{ | ||
public function test_it_can_check_multiple_expressions(): void | ||
{ | ||
$set = ClassSet::fromDir(__DIR__.'/../_fixtures/happy_island'); | ||
|
||
$rule = Rule::allClasses() | ||
->that(new ResideInOneOfTheseNamespaces('App\BadCode')) | ||
->andThat(new ResideInOneOfTheseNamespaces('App\HappyIsland')) | ||
->should(new IsNotFinal()) | ||
->andShould(new IsNotReadonly()) | ||
->andShould(new IsNotAbstract()) | ||
->andShould(new IsNotEnum()) | ||
->andShould(new IsNotInterface()) | ||
->andShould(new IsNotTrait()) | ||
->because('some reason'); | ||
|
||
ArchRuleTestCase::assertArchRule($rule, $set); | ||
} | ||
} |