diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bae0fee..c742960 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,11 +14,18 @@ jobs: fail-fast: false matrix: php_version: - - '8.0' - '8.1' - '8.2' + - '8.3' dependencies: - 'default' + include: + - php_version: '8.1' + dependencies: 'lowest' + - php_version: '8.2' + dependencies: 'lowest' + - php_version: '8.3' + dependencies: 'lowest' steps: - name: Setup PHP diff --git a/CHANGELOG.md b/CHANGELOG.md index 07d9ed0..cab5a81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ ### Unreleased +### v2.0.0 (2024-09-25) + +* [BREAKING] Remove @Assert docblock annotations from request objects. Migrated to using attributes +* Include a validator with this core package (using symfony) with attribute tagging on request objects +* Drop support for PHP 8.0 +* Support PHP 8.3 + ### v1.2.2 (2022-10-31) * Fix deprecation on password ->isCorrect() when hash is null - e.g. if a user's password has never been initialised. diff --git a/README.md b/README.md index 13f22a6..725e454 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,21 @@ This isn't in packagist yet : you'll need to add our package repository to your `$> composer require ingenerator/warden-core` +# Validation + +A default validation interface is included, along with an implementation using symfony validator and a factory to create a validator. + +## Using attribute based mapping + +The warden-core package defines validation mapping by default with attributes on the +various entity and request objects. + +## Using alternate mapping + +If you want to use an alternate validation mapping method (e.g. yaml files / xml files) you will +need to define the appropriate mappings based on the constraints specified in the warden class +annotations, and populate your validation builder appropriately. + # Contributing Contributions are welcome but please contact us before you start work on anything to check your diff --git a/composer.json b/composer.json index 67e07bd..39e413e 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,9 @@ } ], "require": { - "php": "~8.0.0 || ~8.1.0 || ~8.2.0" + "egulias/email-validator": "^4.0", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0", + "symfony/validator": "^6.4" }, "require-dev": { "phpunit/phpunit": "^9.5.5" @@ -36,6 +38,7 @@ } }, "config": { - "preferred-install": "dist" + "preferred-install": "dist", + "sort-packages": true } } diff --git a/src/Interactor/ActivateAccountRequest.php b/src/Interactor/ActivateAccountRequest.php index 1340b21..7c61d92 100644 --- a/src/Interactor/ActivateAccountRequest.php +++ b/src/Interactor/ActivateAccountRequest.php @@ -8,15 +8,13 @@ use Symfony\Component\Validator\Constraints as Assert; -/** @var Assert $annotations keep me to stop phpstorm deleting the import */ - class ActivateAccountRequest extends AbstractRequest implements TokenSignedRequest { /** - * @Assert\NotBlank - * @Assert\Regex("/^\w+/") * @var string */ + #[Assert\NotBlank] + #[Assert\Regex('/^\w+$/')] protected $user_id; /** diff --git a/src/Interactor/ChangeEmailRequest.php b/src/Interactor/ChangeEmailRequest.php index 6a51606..1c756ab 100644 --- a/src/Interactor/ChangeEmailRequest.php +++ b/src/Interactor/ChangeEmailRequest.php @@ -8,23 +8,21 @@ use Symfony\Component\Validator\Constraints as Assert; -/** @var Assert $annotations keep me to stop phpstorm deleting the import */ - class ChangeEmailRequest extends AbstractRequest implements TokenSignedRequest { /** - * @Assert\NotBlank - * @Assert\Regex("/^\w+/") * @var string */ + #[Assert\NotBlank] + #[Assert\Regex('/^\w+$/')] protected $user_id; /** - * @Assert\NotBlank - * @Assert\Email(mode = "strict") * @var string */ + #[Assert\NotBlank] + #[Assert\Email(mode: 'strict')] protected $email; /** diff --git a/src/Interactor/ChangePasswordRequest.php b/src/Interactor/ChangePasswordRequest.php index 79bafc5..a525f39 100644 --- a/src/Interactor/ChangePasswordRequest.php +++ b/src/Interactor/ChangePasswordRequest.php @@ -8,21 +8,20 @@ use Symfony\Component\Validator\Constraints as Assert; -/** @var Assert $annotations keep me to stop phpstorm deleting the import */ class ChangePasswordRequest extends AbstractRequest { /** - * @Assert\NotBlank * @var string */ + #[Assert\NotBlank] protected $current_password; /** - * @Assert\Length(min = 8) - * @Assert\NotBlank * @var string */ + #[Assert\Length(min: 8)] + #[Assert\NotBlank] protected $new_password; /** diff --git a/src/Interactor/EmailVerificationRequest.php b/src/Interactor/EmailVerificationRequest.php index 428e41d..f63d601 100644 --- a/src/Interactor/EmailVerificationRequest.php +++ b/src/Interactor/EmailVerificationRequest.php @@ -10,7 +10,6 @@ use Ingenerator\Warden\Core\Support\UrlProvider; use Symfony\Component\Validator\Constraints as Assert; -/** @var Assert $annotations keep me to stop phpstorm deleting the import */ class EmailVerificationRequest extends AbstractRequest { @@ -26,10 +25,10 @@ class EmailVerificationRequest extends AbstractRequest protected $action; /** - * @Assert\NotBlank - * @Assert\Email(mode = "strict") * @var string */ + #[Assert\NotBlank] + #[Assert\Email(mode: 'strict')] protected $email; /** diff --git a/src/Interactor/LoginRequest.php b/src/Interactor/LoginRequest.php index 7970691..63c0acf 100644 --- a/src/Interactor/LoginRequest.php +++ b/src/Interactor/LoginRequest.php @@ -5,17 +5,17 @@ */ namespace Ingenerator\Warden\Core\Interactor; -use Symfony\Component\Validator\Constraints as Assert; +use Symfony\Component\Validator\Constraints as Assert; class LoginRequest extends AbstractRequest { /** - * @Assert\NotBlank - * @Assert\Email(mode = "loose") * @var string */ + #[Assert\NotBlank] + #[Assert\Email(mode: 'loose')] protected $email; /** diff --git a/src/Interactor/PasswordResetRequest.php b/src/Interactor/PasswordResetRequest.php index 1f85901..3c7f30d 100644 --- a/src/Interactor/PasswordResetRequest.php +++ b/src/Interactor/PasswordResetRequest.php @@ -7,23 +7,21 @@ namespace Ingenerator\Warden\Core\Interactor; use Symfony\Component\Validator\Constraints as Assert; -/** @var Assert $annotations keep me to stop phpstorm deleting the import */ - class PasswordResetRequest extends AbstractRequest implements TokenSignedRequest { /** - * @Assert\NotBlank - * @Assert\Regex("/^\w+/") * @var string */ + #[Assert\NotBlank] + #[Assert\Regex('/^\w+$/')] protected $user_id; /** - * @Assert\Length(min = 8) - * @Assert\NotBlank * @var string */ + #[Assert\Length(min: 8)] + #[Assert\NotBlank] protected $new_password; /** diff --git a/src/Interactor/UserRegistrationRequest.php b/src/Interactor/UserRegistrationRequest.php index e8fbfb1..816c3f3 100644 --- a/src/Interactor/UserRegistrationRequest.php +++ b/src/Interactor/UserRegistrationRequest.php @@ -6,19 +6,16 @@ namespace Ingenerator\Warden\Core\Interactor; - use Ingenerator\Warden\Core\Entity\User; use Symfony\Component\Validator\Constraints as Assert; -/** @var Assert $annotations keep me to stop phpstorm deleting the import */ - class UserRegistrationRequest extends AbstractRequest implements TokenSignedRequest { /** - * @Assert\NotBlank - * @Assert\Email(mode = "strict") * @var string */ + #[Assert\NotBlank] + #[Assert\Email(mode: 'strict')] protected $email; /** @@ -27,10 +24,10 @@ class UserRegistrationRequest extends AbstractRequest implements TokenSignedRequ protected $email_confirmation_token; /** - * @Assert\Length(min = 8) - * @Assert\NotBlank * @var string */ + #[Assert\Length(min: 8)] + #[Assert\NotBlank] protected $password; /** diff --git a/src/Validator/SymfonyValidator.php b/src/Validator/SymfonyValidator.php new file mode 100644 index 0000000..057b7b0 --- /dev/null +++ b/src/Validator/SymfonyValidator.php @@ -0,0 +1,30 @@ + + * @licence proprietary + */ + +namespace Ingenerator\Warden\Core\Validator; + +use Symfony\Component\Validator\ConstraintViolationInterface; +use Symfony\Component\Validator\Validator\ValidatorInterface; + +class SymfonyValidator implements Validator +{ + + public function __construct(protected ValidatorInterface $validator) + { + } + + public function validate($object): array + { + $errors = $this->validator->validate($object); + $error_messages = []; + foreach ($errors as $error) { + /** @var ConstraintViolationInterface $error */ + $error_messages[$error->getPropertyPath()] = $error->getMessage(); + } + + return $error_messages; + } +} diff --git a/src/Validator/SymfonyValidatorFactory.php b/src/Validator/SymfonyValidatorFactory.php new file mode 100644 index 0000000..71092ae --- /dev/null +++ b/src/Validator/SymfonyValidatorFactory.php @@ -0,0 +1,20 @@ + + * @licence proprietary + */ + +namespace Ingenerator\Warden\Core\Validator; + +use Symfony\Component\Validator\Validation; + +class SymfonyValidatorFactory +{ + public static function factory(): SymfonyValidator + { + $builder = Validation::createValidatorBuilder(); + $builder->enableAttributeMapping(); + + return new SymfonyValidator($builder->getValidator()); + } +} diff --git a/test/integration/Repository/ArrayUserRepositoryTest.php b/test/integration/Repository/ArrayUserRepositoryTest.php index d01ee6c..3dd68e4 100644 --- a/test/integration/Repository/ArrayUserRepositoryTest.php +++ b/test/integration/Repository/ArrayUserRepositoryTest.php @@ -9,7 +9,7 @@ use Ingenerator\Warden\Core\Repository\ArrayUserRepository; -class ArrayUserRepositoryTest extends UserRepositoryTest +class ArrayUserRepositoryTest extends UserRepositoryTestCase { /** * @var \ArrayObject diff --git a/test/integration/Repository/UserRepositoryTest.php b/test/integration/Repository/UserRepositoryTestCase.php similarity index 99% rename from test/integration/Repository/UserRepositoryTest.php rename to test/integration/Repository/UserRepositoryTestCase.php index d9e330a..6402f5b 100644 --- a/test/integration/Repository/UserRepositoryTest.php +++ b/test/integration/Repository/UserRepositoryTestCase.php @@ -15,7 +15,7 @@ use Ingenerator\Warden\Core\Repository\UserRepository; use PHPUnit\Framework\TestCase; -abstract class UserRepositoryTest extends TestCase +abstract class UserRepositoryTestCase extends TestCase { /** * @var Configuration diff --git a/test/integration/Validator/SymfonyValidatorTest.php b/test/integration/Validator/SymfonyValidatorTest.php new file mode 100644 index 0000000..5572ebd --- /dev/null +++ b/test/integration/Validator/SymfonyValidatorTest.php @@ -0,0 +1,202 @@ + + * @licence proprietary + */ + +namespace test\integration\Ingenerator\Warden\Core\Validator\Symfony; + + +use Ingenerator\Warden\Core\Interactor\AbstractRequest; +use Ingenerator\Warden\Core\Interactor\ActivateAccountRequest; +use Ingenerator\Warden\Core\Interactor\ChangeEmailRequest; +use Ingenerator\Warden\Core\Interactor\ChangePasswordRequest; +use Ingenerator\Warden\Core\Interactor\EmailVerificationRequest; +use Ingenerator\Warden\Core\Interactor\LoginRequest; +use Ingenerator\Warden\Core\Interactor\PasswordResetRequest; +use Ingenerator\Warden\Core\Interactor\UserRegistrationRequest; +use Ingenerator\Warden\Core\Validator\SymfonyValidator; +use Ingenerator\Warden\Core\Validator\SymfonyValidatorFactory; +use Ingenerator\Warden\Core\Validator\Validator; +use PHPUnit\Framework\TestCase; +use Symfony\Component\Validator\Constraints as Assert; + +class SymfonyValidatorTest extends TestCase +{ + public function test_it_is_initialisable(): void + { + $subject = $this->newSubject(); + $this->assertInstanceOf(SymfonyValidator::class, $subject); + $this->assertInstanceOf(Validator::class, $subject); + } + + public static function providerValidatesInteractorRequests(): array + { + return [ + 'ActivateAccountRequest is valid' => [ + ActivateAccountRequest::fromArray(['user_id' => '1234']), + [], + ], + 'ActivateAccountRequest user_id is not empty' => [ + ActivateAccountRequest::fromArray(['user_id' => '']), + ['user_id' => 'This value should not be blank.'], + ], + 'ActivateAccountRequest user_id is a single word' => [ + ActivateAccountRequest::fromArray(['user_id' => 'foo bar']), + ['user_id' => 'This value is not valid.'], + ], + + 'ChangeEmailRequest is valid' => [ + ChangeEmailRequest::fromArray(['user_id' => '1234', 'email' => 'foo@bar.com']), + [], + ], + 'ChangeEmailRequest values are not empty' => [ + ChangeEmailRequest::fromArray(['user_id' => '', 'email' => '']), + [ + 'user_id' => 'This value should not be blank.', + 'email' => 'This value should not be blank.', + ], + ], + 'ChangeEmailRequest user_id is a single word' => [ + ChangeEmailRequest::fromArray(['user_id' => 'foo bar', 'email' => 'foo@bar.com']), + ['user_id' => 'This value is not valid.'], + ], + 'ChangeEmailRequest email is valid email address' => [ + ChangeEmailRequest::fromArray(['user_id' => '1234', 'email' => 'some nonsense']), + ['email' => 'This value is not a valid email address.'], + ], + + 'ChangePasswordRequest is valid' => [ + ChangePasswordRequest::fromArray(['current_password' => '12345678', 'new_password' => '12345678']), + [], + ], + 'ChangePasswordRequest values are not blank' => [ + ChangePasswordRequest::fromArray(['current_password' => '', 'new_password' => '']), + [ + 'current_password' => 'This value should not be blank.', + 'new_password' => 'This value should not be blank.', + ], + ], + 'ChangePasswordRequest new password is at least 8 chars long' => [ + ChangePasswordRequest::fromArray(['current_password' => '12345678', 'new_password' => '1234567']), + ['new_password' => 'This value is too short. It should have 8 characters or more.'], + ], + + 'EmailVerificationRequest is valid' => [ + EmailVerificationRequest::fromArray(['email' => 'foo@bar.com']), + [], + ], + 'EmailVerificationRequest email is not blank' => [ + EmailVerificationRequest::fromArray(['email' => '']), + ['email' => 'This value should not be blank.'], + ], + 'EmailVerificationRequest email is valid email address' => [ + EmailVerificationRequest::fromArray(['email' => 'some nonsense']), + ['email' => 'This value is not a valid email address.'], + ], + + 'LoginRequest is valid' => [ + LoginRequest::fromArray(['email' => 'foo@bar.com']), + [], + ], + 'LoginRequest email is not blank' => [ + LoginRequest::fromArray(['email' => '']), + ['email' => 'This value should not be blank.'], + ], + 'LoginRequest email is valid email address' => [ + LoginRequest::fromArray(['email' => 'some nonsense']), + ['email' => 'This value is not a valid email address.'], + ], + + 'PasswordResetRequest is valid' => [ + PasswordResetRequest::fromArray(['user_id' => '1234', 'new_password' => '12345678']), + [], + ], + 'PasswordResetRequest values are not blank' => [ + PasswordResetRequest::fromArray(['user_id' => '', 'new_password' => '']), + [ + 'user_id' => 'This value should not be blank.', + 'new_password' => 'This value should not be blank.', + ], + ], + 'PasswordResetRequest user_id is a single word' => [ + PasswordResetRequest::fromArray(['user_id' => 'foo bar', 'new_password' => '12345678']), + ['user_id' => 'This value is not valid.'], + ], + 'PasswordResetRequest new password is at least 8 chars long' => [ + PasswordResetRequest::fromArray(['user_id' => '1234', 'new_password' => '1234567']), + ['new_password' => 'This value is too short. It should have 8 characters or more.'], + ], + + 'UserRegistrationRequest is valid' => [ + UserRegistrationRequest::fromArray(['email' => 'foo@bar.com', 'password' => '12345678']), + [], + ], + 'UserRegistrationRequest values are not blank' => [ + UserRegistrationRequest::fromArray(['email' => '', 'password' => '']), + [ + 'email' => 'This value should not be blank.', + 'password' => 'This value should not be blank.', + ], + ], + 'UserRegistrationRequest password is at least 8 chars long' => [ + UserRegistrationRequest::fromArray(['email' => 'foo@bar.com', 'password' => '1234567']), + ['password' => 'This value is too short. It should have 8 characters or more.'], + ], + 'UserRegistrationRequest email is valid email address' => [ + UserRegistrationRequest::fromArray(['email' => 'some nonsense', 'password' => '12345678']), + ['email' => 'This value is not a valid email address.'], + ], + ]; + } + + /** + * @dataProvider providerValidatesInteractorRequests + */ + public function test_it_validates_interactor_requests(AbstractRequest $request, array $expect): void + { + $subject = $this->newSubject(); + $this->assertSame($expect, $subject->validate($request)); + } + + public static function providerValidationRulesInheritedByChildClass(): array + { + return [ + [ + ['email' => 'foo@bar.com', 'password' => '12345678', 'name' => 'Foo'], + [], + ], + [ + ['email' => '', 'password' => '', 'name' => ''], + [ + 'name' => 'This value should not be blank.', + 'email' => 'This value should not be blank.', + 'password' => 'This value should not be blank.', + ], + ], + ]; + } + + /** + * @dataProvider providerValidationRulesInheritedByChildClass + */ + public function test_validation_rules_are_inherited_by_child_class(array $values, array $expect): void + { + $subject = $this->newSubject(); + $extended = new class extends UserRegistrationRequest { + #[Assert\NotBlank] + protected string $name; + + public function __construct(){ + } + }; + + $this->assertSame($expect, $subject->validate($extended::fromArray($values))); + } + + private function newSubject(): SymfonyValidator + { + return SymfonyValidatorFactory::factory(); + } + +} diff --git a/test/unit/Interactor/AbstractInteractorTest.php b/test/unit/Interactor/AbstractInteractorTestCase.php similarity index 91% rename from test/unit/Interactor/AbstractInteractorTest.php rename to test/unit/Interactor/AbstractInteractorTestCase.php index 8134f33..99f3296 100644 --- a/test/unit/Interactor/AbstractInteractorTest.php +++ b/test/unit/Interactor/AbstractInteractorTestCase.php @@ -10,7 +10,7 @@ use Ingenerator\Warden\Core\Interactor\AbstractResponse; use PHPUnit\Framework\TestCase; -abstract class AbstractInteractorTest extends TestCase +abstract class AbstractInteractorTestCase extends TestCase { protected function assertFailsWithCode($code, AbstractResponse $result) diff --git a/test/unit/Interactor/ActivateAccountInteractorTest.php b/test/unit/Interactor/ActivateAccountInteractorTest.php index 50cd9b3..965e2e7 100644 --- a/test/unit/Interactor/ActivateAccountInteractorTest.php +++ b/test/unit/Interactor/ActivateAccountInteractorTest.php @@ -23,7 +23,7 @@ use test\mock\Ingenerator\Warden\Core\Support\InsecureJSONTokenServiceStub; use test\mock\Ingenerator\Warden\Core\Validator\ValidatorStub; -class ActivateAccountInteractorTest extends AbstractInteractorTest +class ActivateAccountInteractorTest extends AbstractInteractorTestCase { /** diff --git a/test/unit/Interactor/ChangeEmailInteractorTest.php b/test/unit/Interactor/ChangeEmailInteractorTest.php index ad34a8c..f308bf5 100644 --- a/test/unit/Interactor/ChangeEmailInteractorTest.php +++ b/test/unit/Interactor/ChangeEmailInteractorTest.php @@ -23,7 +23,7 @@ use test\mock\Ingenerator\Warden\Core\Support\InsecureJSONTokenServiceStub; use test\mock\Ingenerator\Warden\Core\Validator\ValidatorStub; -class ChangeEmailInteractorTest extends AbstractInteractorTest +class ChangeEmailInteractorTest extends AbstractInteractorTestCase { /** diff --git a/test/unit/Interactor/ChangePasswordInteractorTest.php b/test/unit/Interactor/ChangePasswordInteractorTest.php index 47ca519..d17802d 100644 --- a/test/unit/Interactor/ChangePasswordInteractorTest.php +++ b/test/unit/Interactor/ChangePasswordInteractorTest.php @@ -19,7 +19,7 @@ use test\mock\Ingenerator\Warden\Core\Support\ReversingPassswordHasherStub; use test\mock\Ingenerator\Warden\Core\Validator\ValidatorStub; -class ChangePasswordInteractorTest extends AbstractInteractorTest +class ChangePasswordInteractorTest extends AbstractInteractorTestCase { /** diff --git a/test/unit/Interactor/EmailVerificationInteractorTest.php b/test/unit/Interactor/EmailVerificationInteractorTest.php index 0a4d048..30dee59 100644 --- a/test/unit/Interactor/EmailVerificationInteractorTest.php +++ b/test/unit/Interactor/EmailVerificationInteractorTest.php @@ -24,7 +24,7 @@ use test\mock\Ingenerator\Warden\Core\Support\UserNotificationMailerSpy; use test\mock\Ingenerator\Warden\Core\Validator\ValidatorStub; -class EmailVerificationInteractorTest extends AbstractInteractorTest +class EmailVerificationInteractorTest extends AbstractInteractorTestCase { /** * @var EmailConfirmationTokenService diff --git a/test/unit/Interactor/LoginInteractorTest.php b/test/unit/Interactor/LoginInteractorTest.php index a3dc930..7079c43 100644 --- a/test/unit/Interactor/LoginInteractorTest.php +++ b/test/unit/Interactor/LoginInteractorTest.php @@ -33,7 +33,7 @@ use test\mock\Ingenerator\Warden\Core\Support\ReversingPassswordHasherStub; use test\mock\Ingenerator\Warden\Core\Validator\ValidatorStub; -class LoginInteractorTest extends AbstractInteractorTest +class LoginInteractorTest extends AbstractInteractorTestCase { /** * @var EmailVerificationInteractorSpy diff --git a/test/unit/Interactor/PasswordResetInteractorTest.php b/test/unit/Interactor/PasswordResetInteractorTest.php index dd1092c..56a0ad4 100644 --- a/test/unit/Interactor/PasswordResetInteractorTest.php +++ b/test/unit/Interactor/PasswordResetInteractorTest.php @@ -24,7 +24,7 @@ use test\mock\Ingenerator\Warden\Core\Support\ValidInvalidTokenServiceStub; use test\mock\Ingenerator\Warden\Core\Validator\ValidatorStub; -class PasswordResetInteractorTest extends AbstractInteractorTest +class PasswordResetInteractorTest extends AbstractInteractorTestCase { /** * @var ReversingPassswordHasherStub diff --git a/test/unit/Interactor/UserRegistrationInteractorTest.php b/test/unit/Interactor/UserRegistrationInteractorTest.php index 71a055e..fa55976 100644 --- a/test/unit/Interactor/UserRegistrationInteractorTest.php +++ b/test/unit/Interactor/UserRegistrationInteractorTest.php @@ -26,7 +26,7 @@ use test\mock\Ingenerator\Warden\Core\Support\ValidInvalidTokenServiceStub; use test\mock\Ingenerator\Warden\Core\Validator\ValidatorStub; -class UserRegistrationInteractorTest extends AbstractInteractorTest +class UserRegistrationInteractorTest extends AbstractInteractorTestCase { protected $config = [ 'registration' => [ diff --git a/test/unit/UserSession/ArrayUserSessionTest.php b/test/unit/UserSession/ArrayUserSessionTest.php index ec829d1..0a1ecf7 100644 --- a/test/unit/UserSession/ArrayUserSessionTest.php +++ b/test/unit/UserSession/ArrayUserSessionTest.php @@ -9,7 +9,7 @@ use Ingenerator\Warden\Core\UserSession\SimplePropertyUserSession; -class ArrayUserSessionTest extends UserSessionTest +class ArrayUserSessionTest extends UserSessionTestCase { public function newSubject() diff --git a/test/unit/UserSession/UserSessionTest.php b/test/unit/UserSession/UserSessionTestCase.php similarity index 94% rename from test/unit/UserSession/UserSessionTest.php rename to test/unit/UserSession/UserSessionTestCase.php index d1ca809..ba7a088 100644 --- a/test/unit/UserSession/UserSessionTest.php +++ b/test/unit/UserSession/UserSessionTestCase.php @@ -9,9 +9,10 @@ use BadMethodCallException; use Ingenerator\Warden\Core\Entity\SimpleUser; use Ingenerator\Warden\Core\UserSession\UserSession; +use PHPUnit\Framework\TestCase; use test\mock\Ingenerator\Warden\Core\Entity\UserStub; -abstract class UserSessionTest extends \PHPUnit\Framework\TestCase +abstract class UserSessionTestCase extends TestCase { public function test_it_is_initialisable()