use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Mapping\Loader\AttributeLoader;
class UniqueEntityTest extends TestCase
{ public function testAttributeWithDefaultProperty() { $metadata =
new ClassMetadata(UniqueEntityDummyOne::
class);
$loader =
new AttributeLoader();
self::
assertTrue($loader->
loadClassMetadata($metadata));
/** @var UniqueEntity $constraint */
[$constraint] =
$metadata->
getConstraints();
self::
assertSame(['email'
],
$constraint->fields
);
self::
assertTrue($constraint->ignoreNull
);
self::
assertSame('doctrine.orm.validator.unique',
$constraint->
validatedBy());
self::
assertSame(['Default', 'UniqueEntityDummyOne'
],
$constraint->groups
);
} public function testAttributeWithCustomizedService() {