use PHPUnit\Framework\TestCase;
use Symfony\Component\Validator\Constraints\CardScheme;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Mapping\Loader\AttributeLoader;
class CardSchemeTest extends TestCase
{ public function testAttributes() { $metadata =
new ClassMetadata(CardSchemeDummy::
class);
$loader =
new AttributeLoader();
self::
assertTrue($loader->
loadClassMetadata($metadata));
[$aConstraint] =
$metadata->properties
['a'
]->
getConstraints();
self::
assertSame([CardScheme::MASTERCARD, CardScheme::VISA
],
$aConstraint->schemes
);
[$bConstraint] =
$metadata->properties
['b'
]->
getConstraints();
self::
assertSame([CardScheme::AMEX
],
$bConstraint->schemes
);
self::
assertSame('myMessage',
$bConstraint->message
);
self::
assertSame(['Default', 'CardSchemeDummy'
],
$bConstraint->groups
);
[$cConstraint] =
$metadata->properties
['c'
]->
getConstraints();
self::
assertSame([CardScheme::DINERS
],
$cConstraint->schemes
);