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\Role;
|
||||
use App\Validator\Constraints\RoleValidator;
|
||||
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\Role
|
||||
* @covers \App\Validator\Constraints\RoleValidator
|
||||
* @extends ConstraintValidatorTestCase<RoleValidator>
|
||||
*/
|
||||
#[CoversClass(Role::class)]
|
||||
#[CoversClass(RoleValidator::class)]
|
||||
class RoleValidatorTest extends ConstraintValidatorTestCase
|
||||
{
|
||||
protected function createValidator(): RoleValidator
|
||||
@@ -49,9 +51,7 @@ class RoleValidatorTest extends ConstraintValidatorTestCase
|
||||
$this->validator->validate('foo', new NotBlank());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getValidRoles
|
||||
*/
|
||||
#[DataProvider('getValidRoles')]
|
||||
public function testConstraintWithValidRole(string $role): void
|
||||
{
|
||||
$constraint = new Role();
|
||||
@@ -81,9 +81,7 @@ class RoleValidatorTest extends ConstraintValidatorTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getInvalidRoles
|
||||
*/
|
||||
#[DataProvider('getInvalidRoles')]
|
||||
public function testValidationError(mixed $role): void
|
||||
{
|
||||
$constraint = new Role([
|
||||
|
||||
Reference in New Issue
Block a user