-
-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #888 from pestphp/feat_opposite_suffix_prefix
feat(arch): Adds support for opposite expectations of `toHavePrefix` and `toHaveSuffix`
- Loading branch information
Showing
9 changed files
with
96 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
use Pest\Arch\Exceptions\ArchExpectationFailedException; | ||
|
||
test('missing prefix') | ||
->throws(ArchExpectationFailedException::class) | ||
->expect('Tests\\Fixtures\\Arch\\ToHavePrefix\\HasNoPrefix') | ||
->toHavePrefix('Prefix'); | ||
|
||
test('has prefix') | ||
->expect('Tests\\Fixtures\\Arch\\ToHavePrefix\\HasPrefix') | ||
->toHavePrefix('Prefix'); | ||
|
||
test('opposite missing prefix') | ||
->throws(ArchExpectationFailedException::class) | ||
->expect('Tests\\Fixtures\\Arch\\ToHavePrefix\\HasPrefix') | ||
->not->toHavePrefix('Prefix'); | ||
|
||
test('opposite has prefix') | ||
->expect('Tests\\Fixtures\\Arch\\ToHavePrefix\\HasNoPrefix') | ||
->not->toHavePrefix('Prefix'); |
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,21 @@ | ||
<?php | ||
|
||
use Pest\Arch\Exceptions\ArchExpectationFailedException; | ||
|
||
test('missing suffix') | ||
->throws(ArchExpectationFailedException::class) | ||
->expect('Tests\\Fixtures\\Arch\\ToHaveSuffix\\HasNoSuffix') | ||
->toHaveSuffix('Suffix'); | ||
|
||
test('has suffix') | ||
->expect('Tests\\Fixtures\\Arch\\ToHaveSuffix\\HasSuffix') | ||
->toHaveSuffix('Suffix'); | ||
|
||
test('opposite missing suffix') | ||
->throws(ArchExpectationFailedException::class) | ||
->expect('Tests\\Fixtures\\Arch\\ToHaveSuffix\\HasSuffix') | ||
->not->toHaveSuffix('Suffix'); | ||
|
||
test('opposite has suffix') | ||
->expect('Tests\\Fixtures\\Arch\\ToHaveSuffix\\HasNoSuffix') | ||
->not->toHaveSuffix('Suffix'); |
9 changes: 9 additions & 0 deletions
9
tests/Fixtures/Arch/ToHavePrefix/HasNoPrefix/ClassWithout.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,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Fixtures\Arch\ToHavePrefix\HasNoPrefix; | ||
|
||
class ClassWithout | ||
{ | ||
} |
9 changes: 9 additions & 0 deletions
9
tests/Fixtures/Arch/ToHavePrefix/HasPrefix/PrefixClassWith.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,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Fixtures\Arch\ToHavePrefix\HasPrefix; | ||
|
||
class PrefixClassWith | ||
{ | ||
} |
9 changes: 9 additions & 0 deletions
9
tests/Fixtures/Arch/ToHaveSuffix/HasNoSuffix/ClassWithout.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,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Fixtures\Arch\ToHaveSuffix\HasNoSuffix; | ||
|
||
class ClassWithout | ||
{ | ||
} |
9 changes: 9 additions & 0 deletions
9
tests/Fixtures/Arch/ToHaveSuffix/HasSuffix/ClassWithSuffix.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,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Fixtures\Arch\ToHaveSuffix\HasSuffix; | ||
|
||
class ClassWithSuffix | ||
{ | ||
} |