mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
feat(arch): Adds support for opposite expectations of toHavePrefix and toHaveSuffix.
This commit is contained in:
21
tests/Features/Expect/toHavePrefix.php
Normal file
21
tests/Features/Expect/toHavePrefix.php
Normal file
@ -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');
|
||||
21
tests/Features/Expect/toHaveSuffix.php
Normal file
21
tests/Features/Expect/toHaveSuffix.php
Normal file
@ -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');
|
||||
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Fixtures\Arch\ToHavePrefix\HasNoPrefix;
|
||||
|
||||
class ClassWithout
|
||||
{
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Fixtures\Arch\ToHavePrefix\HasPrefix;
|
||||
|
||||
class PrefixClassWith
|
||||
{
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Fixtures\Arch\ToHaveSuffix\HasNoSuffix;
|
||||
|
||||
class ClassWithout
|
||||
{
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Fixtures\Arch\ToHaveSuffix\HasSuffix;
|
||||
|
||||
class ClassWithSuffix
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user