replace PHPUnit annotations with attributes (#5608)
This commit is contained in:
@@ -13,15 +13,17 @@ use App\Entity\User;
|
||||
use App\Tests\Mocks\Security\RoleServiceFactory;
|
||||
use App\Validator\Constraints\RoleName;
|
||||
use App\Validator\Constraints\RoleNameValidator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Validator\Constraints\RoleName
|
||||
* @covers \App\Validator\Constraints\RoleNameValidator
|
||||
* @extends ConstraintValidatorTestCase<RoleNameValidator>
|
||||
*/
|
||||
#[CoversClass(RoleName::class)]
|
||||
#[CoversClass(RoleNameValidator::class)]
|
||||
class RoleNameValidatorTest extends ConstraintValidatorTestCase
|
||||
{
|
||||
protected function createValidator(): RoleNameValidator
|
||||
@@ -52,9 +54,7 @@ class RoleNameValidatorTest extends ConstraintValidatorTestCase
|
||||
$this->validator->validate('foo', new NotBlank());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getValidRoleNames
|
||||
*/
|
||||
#[DataProvider('getValidRoleNames')]
|
||||
public function testConstraintWithValidRole(string $role): void
|
||||
{
|
||||
$constraint = new RoleName();
|
||||
@@ -96,9 +96,7 @@ class RoleNameValidatorTest extends ConstraintValidatorTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getInvalidRoleNames
|
||||
*/
|
||||
#[DataProvider('getInvalidRoleNames')]
|
||||
public function testValidationError(string|int $role): void
|
||||
{
|
||||
$constraint = new RoleName([
|
||||
|
||||
Reference in New Issue
Block a user