[Validator] Renamed ConstraintValidatorInterface::isValid() to validate() because of the lack of a return value
This commit is contained in:
parent
46f0393f70
commit
6336d9314e
@ -41,7 +41,7 @@ class UniqueEntityValidator extends ConstraintValidator
|
||||
* @param object $entity
|
||||
* @param Constraint $constraint
|
||||
*/
|
||||
public function isValid($entity, Constraint $constraint)
|
||||
public function validate($entity, Constraint $constraint)
|
||||
{
|
||||
if (!is_array($constraint->fields) && !is_string($constraint->fields)) {
|
||||
throw new UnexpectedTypeException($constraint->fields, 'array');
|
||||
|
@ -29,7 +29,7 @@ class UserPasswordValidator extends ConstraintValidator
|
||||
$this->encoderFactory = $encoderFactory;
|
||||
}
|
||||
|
||||
public function isValid($password, Constraint $constraint)
|
||||
public function validate($password, Constraint $constraint)
|
||||
{
|
||||
$user = $this->securityContext->getToken()->getUser();
|
||||
|
||||
|
@ -33,5 +33,5 @@ interface ConstraintValidatorInterface
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
function isValid($value, Constraint $constraint);
|
||||
function validate($value, Constraint $constraint);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class AllValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value) {
|
||||
return;
|
||||
|
@ -29,7 +29,7 @@ class BlankValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if ('' !== $value && null !== $value) {
|
||||
$this->context->addViolation($constraint->message, array('{{ value }}' => $value));
|
||||
|
@ -33,7 +33,7 @@ class CallbackValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($object, Constraint $constraint)
|
||||
public function validate($object, Constraint $constraint)
|
||||
{
|
||||
if (null === $object) {
|
||||
return;
|
||||
|
@ -35,7 +35,7 @@ class ChoiceValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (!$constraint->choices && !$constraint->callback) {
|
||||
throw new ConstraintDefinitionException('Either "choices" or "callback" must be specified on constraint Choice');
|
||||
|
@ -32,7 +32,7 @@ class CollectionValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value) {
|
||||
return;
|
||||
|
@ -32,7 +32,7 @@ class CountryValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
|
@ -32,7 +32,7 @@ class DateValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || '' === $value || $value instanceof \DateTime) {
|
||||
return;
|
||||
|
@ -30,7 +30,7 @@ class EmailValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
|
@ -29,7 +29,7 @@ class FalseValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || false === $value || 0 === $value || '0' === $value) {
|
||||
return;
|
||||
|
@ -33,7 +33,7 @@ class FileValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
|
@ -22,15 +22,15 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
|
||||
*/
|
||||
class ImageValidator extends FileValidator
|
||||
{
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
$violations = count($this->context->getViolations());
|
||||
|
||||
parent::isValid($value, $constraint);
|
||||
parent::validate($value, $constraint);
|
||||
|
||||
$isValid = count($this->context->getViolations()) === $violations;
|
||||
$failed = count($this->context->getViolations()) !== $violations;
|
||||
|
||||
if (!$isValid || null === $value || '' === $value) {
|
||||
if ($failed || null === $value || '' === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ class IpValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
|
@ -32,7 +32,7 @@ class LanguageValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
|
@ -32,7 +32,7 @@ class LocaleValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
|
@ -30,7 +30,7 @@ class MaxLengthValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
|
@ -29,7 +29,7 @@ class MaxValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value) {
|
||||
return;
|
||||
|
@ -30,7 +30,7 @@ class MinLengthValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
|
@ -29,7 +29,7 @@ class MinValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value) {
|
||||
return;
|
||||
|
@ -29,7 +29,7 @@ class NotBlankValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (false === $value || (empty($value) && '0' != $value)) {
|
||||
$this->context->addViolation($constraint->message);
|
||||
|
@ -29,7 +29,7 @@ class NotNullValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value) {
|
||||
$this->context->addViolation($constraint->message);
|
||||
|
@ -29,7 +29,7 @@ class NullValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null !== $value) {
|
||||
$this->context->addViolation($constraint->message, array('{{ value }}' => $value));
|
||||
|
@ -33,7 +33,7 @@ class RegexValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
|
@ -28,7 +28,7 @@ class SizeLengthValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
|
@ -31,7 +31,7 @@ class SizeValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value) {
|
||||
return;
|
||||
|
@ -32,7 +32,7 @@ class TimeValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || '' === $value || $value instanceof \DateTime) {
|
||||
return;
|
||||
|
@ -29,7 +29,7 @@ class TrueValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value) {
|
||||
return true;
|
||||
|
@ -29,7 +29,7 @@ class TypeValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value) {
|
||||
return;
|
||||
|
@ -45,7 +45,7 @@ class UrlValidator extends ConstraintValidator
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
|
@ -183,6 +183,6 @@ class GraphWalker
|
||||
);
|
||||
|
||||
$validator->initialize($localContext);
|
||||
$validator->isValid($value, $constraint);
|
||||
$validator->validate($value, $constraint);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class ConstraintValidatorTest_Validator extends ConstraintValidator
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
$this->setMessage($this->message, $this->params);
|
||||
}
|
||||
@ -44,7 +44,7 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation')
|
||||
->with('error message', array('foo' => 'bar'));
|
||||
|
||||
$validator->isValid('bam', $constraint);
|
||||
$validator->validate('bam', $constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,6 +55,6 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$constraint = $this->getMock('Symfony\Component\Validator\Constraint', array(), array(), '', false);
|
||||
$validator = new ConstraintValidatorTest_Validator('error message', array('foo' => 'bar'));
|
||||
|
||||
$validator->isValid('bam', $constraint);
|
||||
$validator->validate('bam', $constraint);
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ class AllValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new All(new Min(4)));
|
||||
$this->validator->validate(null, new All(new Min(4)));
|
||||
}
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ class AllValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testThrowsExceptionIfNotTraversable()
|
||||
{
|
||||
$this->validator->isValid('foo.barbar', new All(new Min(4)));
|
||||
$this->validator->validate('foo.barbar', new All(new Min(4)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,7 +84,7 @@ class AllValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($array, new All($constraint));
|
||||
$this->validator->validate($array, new All($constraint));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,7 +110,7 @@ class AllValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($array, new All($constraints));
|
||||
$this->validator->validate($array, new All($constraints));
|
||||
}
|
||||
|
||||
public function getValidArguments()
|
||||
|
@ -37,7 +37,7 @@ class BlankValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Blank());
|
||||
$this->validator->validate(null, new Blank());
|
||||
}
|
||||
|
||||
public function testBlankIsValid()
|
||||
@ -45,7 +45,7 @@ class BlankValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new Blank());
|
||||
$this->validator->validate('', new Blank());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,7 +63,7 @@ class BlankValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $value,
|
||||
));
|
||||
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidValues()
|
||||
|
@ -65,7 +65,7 @@ class CallbackValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Callback(array('foo')));
|
||||
$this->validator->validate(null, new Callback(array('foo')));
|
||||
}
|
||||
|
||||
public function testCallbackSingleMethod()
|
||||
@ -79,7 +79,7 @@ class CallbackValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => 'foobar',
|
||||
));
|
||||
|
||||
$this->validator->isValid($object, $constraint);
|
||||
$this->validator->validate($object, $constraint);
|
||||
}
|
||||
|
||||
public function testCallbackSingleStaticMethod()
|
||||
@ -92,7 +92,7 @@ class CallbackValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => 'foobar',
|
||||
));
|
||||
|
||||
$this->validator->isValid($object, new Callback(array(
|
||||
$this->validator->validate($object, new Callback(array(
|
||||
array(__CLASS__.'_Class', 'validateStatic')
|
||||
)));
|
||||
}
|
||||
@ -113,7 +113,7 @@ class CallbackValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
));
|
||||
|
||||
|
||||
$this->validator->isValid($object, new Callback(array(
|
||||
$this->validator->validate($object, new Callback(array(
|
||||
'validateOne', 'validateTwo'
|
||||
)));
|
||||
}
|
||||
@ -125,7 +125,7 @@ class CallbackValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$object = new CallbackValidatorTest_Object();
|
||||
|
||||
$this->validator->isValid($object, new Callback('foobar'));
|
||||
$this->validator->validate($object, new Callback('foobar'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,7 +135,7 @@ class CallbackValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$object = new CallbackValidatorTest_Object();
|
||||
|
||||
$this->validator->isValid($object, new Callback(array('foobar')));
|
||||
$this->validator->validate($object, new Callback(array('foobar')));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -145,7 +145,7 @@ class CallbackValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$object = new CallbackValidatorTest_Object();
|
||||
|
||||
$this->validator->isValid($object, new Callback(array(array('foo', 'bar'))));
|
||||
$this->validator->validate($object, new Callback(array(array('foo', 'bar'))));
|
||||
}
|
||||
|
||||
public function testConstraintGetTargets()
|
||||
|
@ -58,7 +58,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'multiple' => true,
|
||||
));
|
||||
|
||||
$this->validator->isValid('asdf', $constraint);
|
||||
$this->validator->validate('asdf', $constraint);
|
||||
}
|
||||
|
||||
public function testNullIsValid()
|
||||
@ -66,7 +66,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Choice(array('choices' => array('foo', 'bar'))));
|
||||
$this->validator->validate(null, new Choice(array('choices' => array('foo', 'bar'))));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,7 +74,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testChoicesOrCallbackExpected()
|
||||
{
|
||||
$this->validator->isValid('foobar', new Choice());
|
||||
$this->validator->validate('foobar', new Choice());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,7 +82,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testValidCallbackExpected()
|
||||
{
|
||||
$this->validator->isValid('foobar', new Choice(array('callback' => 'abcd')));
|
||||
$this->validator->validate('foobar', new Choice(array('callback' => 'abcd')));
|
||||
}
|
||||
|
||||
public function testValidChoiceArray()
|
||||
@ -92,7 +92,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('bar', $constraint);
|
||||
$this->validator->validate('bar', $constraint);
|
||||
}
|
||||
|
||||
public function testValidChoiceCallbackFunction()
|
||||
@ -102,7 +102,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('bar', $constraint);
|
||||
$this->validator->validate('bar', $constraint);
|
||||
}
|
||||
|
||||
public function testValidChoiceCallbackClosure()
|
||||
@ -114,7 +114,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('bar', $constraint);
|
||||
$this->validator->validate('bar', $constraint);
|
||||
}
|
||||
|
||||
public function testValidChoiceCallbackStaticMethod()
|
||||
@ -124,7 +124,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('bar', $constraint);
|
||||
$this->validator->validate('bar', $constraint);
|
||||
}
|
||||
|
||||
public function testValidChoiceCallbackContextMethod()
|
||||
@ -134,7 +134,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('bar', $constraint);
|
||||
$this->validator->validate('bar', $constraint);
|
||||
}
|
||||
|
||||
public function testMultipleChoices()
|
||||
@ -147,7 +147,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(array('baz', 'bar'), $constraint);
|
||||
$this->validator->validate(array('baz', 'bar'), $constraint);
|
||||
}
|
||||
|
||||
public function testInvalidChoice()
|
||||
@ -163,7 +163,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => 'baz',
|
||||
), null, null);
|
||||
|
||||
$this->validator->isValid('baz', $constraint);
|
||||
$this->validator->validate('baz', $constraint);
|
||||
}
|
||||
|
||||
public function testInvalidChoiceMultiple()
|
||||
@ -180,7 +180,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => 'baz',
|
||||
));
|
||||
|
||||
$this->validator->isValid(array('foo', 'baz'), $constraint);
|
||||
$this->validator->validate(array('foo', 'baz'), $constraint);
|
||||
}
|
||||
|
||||
public function testTooFewChoices()
|
||||
@ -198,7 +198,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ limit }}' => 2,
|
||||
), null, 2);
|
||||
|
||||
$this->validator->isValid(array('foo'), $constraint);
|
||||
$this->validator->validate(array('foo'), $constraint);
|
||||
}
|
||||
|
||||
public function testTooManyChoices()
|
||||
@ -216,7 +216,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ limit }}' => 2,
|
||||
), null, 2);
|
||||
|
||||
$this->validator->isValid(array('foo', 'bar', 'moo'), $constraint);
|
||||
$this->validator->validate(array('foo', 'bar', 'moo'), $constraint);
|
||||
}
|
||||
|
||||
public function testNonStrict()
|
||||
@ -229,8 +229,8 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('2', $constraint);
|
||||
$this->validator->isValid(2, $constraint);
|
||||
$this->validator->validate('2', $constraint);
|
||||
$this->validator->validate(2, $constraint);
|
||||
}
|
||||
|
||||
public function testStrictAllowsExactValue()
|
||||
@ -243,7 +243,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(2, $constraint);
|
||||
$this->validator->validate(2, $constraint);
|
||||
}
|
||||
|
||||
public function testStrictDisallowsDifferentType()
|
||||
@ -260,7 +260,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => '2',
|
||||
));
|
||||
|
||||
$this->validator->isValid('2', $constraint);
|
||||
$this->validator->validate('2', $constraint);
|
||||
}
|
||||
|
||||
public function testNonStrictWithMultipleChoices()
|
||||
@ -274,7 +274,7 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(array('2', 3), $constraint);
|
||||
$this->validator->validate(array('2', 3), $constraint);
|
||||
}
|
||||
|
||||
public function testStrictWithMultipleChoices()
|
||||
@ -292,6 +292,6 @@ class ChoiceValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => '3',
|
||||
));
|
||||
|
||||
$this->validator->isValid(array(2, '3'), $constraint);
|
||||
$this->validator->validate(array(2, '3'), $constraint);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolationAtSubPath');
|
||||
|
||||
$this->validator->isValid(null, new Collection(array('fields' => array(
|
||||
$this->validator->validate(null, new Collection(array('fields' => array(
|
||||
'foo' => new Min(4),
|
||||
))));
|
||||
}
|
||||
@ -70,7 +70,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolationAtSubPath');
|
||||
|
||||
$this->validator->isValid($data, new Collection(array(
|
||||
$this->validator->validate($data, new Collection(array(
|
||||
'foo' => new Min(4),
|
||||
)));
|
||||
}
|
||||
@ -80,7 +80,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testThrowsExceptionIfNotTraversable()
|
||||
{
|
||||
$this->validator->isValid('foobar', new Collection(array('fields' => array(
|
||||
$this->validator->validate('foobar', new Collection(array('fields' => array(
|
||||
'foo' => new Min(4),
|
||||
))));
|
||||
}
|
||||
@ -106,7 +106,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolationAtSubPath');
|
||||
|
||||
$this->validator->isValid($data, new Collection(array(
|
||||
$this->validator->validate($data, new Collection(array(
|
||||
'fields' => array(
|
||||
'foo' => $constraint,
|
||||
'bar' => $constraint,
|
||||
@ -140,7 +140,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolationAtSubPath');
|
||||
|
||||
$this->validator->isValid($data, new Collection(array(
|
||||
$this->validator->validate($data, new Collection(array(
|
||||
'fields' => array(
|
||||
'foo' => $constraints,
|
||||
'bar' => $constraints,
|
||||
@ -161,7 +161,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ field }}' => 'baz'
|
||||
));
|
||||
|
||||
$this->validator->isValid($data, new Collection(array(
|
||||
$this->validator->validate($data, new Collection(array(
|
||||
'fields' => array(
|
||||
'foo' => new Min(4),
|
||||
),
|
||||
@ -185,7 +185,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolationAtSubPath');
|
||||
|
||||
$this->validator->isValid($data, $constraint);
|
||||
$this->validator->validate($data, $constraint);
|
||||
}
|
||||
|
||||
public function testExtraFieldsAllowed()
|
||||
@ -205,7 +205,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolationAtSubPath');
|
||||
|
||||
$this->validator->isValid($data, $constraint);
|
||||
$this->validator->validate($data, $constraint);
|
||||
}
|
||||
|
||||
public function testMissingFieldsDisallowed()
|
||||
@ -225,7 +225,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ field }}' => 'foo',
|
||||
));
|
||||
|
||||
$this->validator->isValid($data, $constraint);
|
||||
$this->validator->validate($data, $constraint);
|
||||
}
|
||||
|
||||
public function testMissingFieldsAllowed()
|
||||
@ -242,7 +242,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolationAtSubPath');
|
||||
|
||||
$this->validator->isValid($data, $constraint);
|
||||
$this->validator->validate($data, $constraint);
|
||||
}
|
||||
|
||||
public function testOptionalFieldPresent()
|
||||
@ -254,7 +254,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolationAtSubPath');
|
||||
|
||||
$this->validator->isValid($data, new Collection(array(
|
||||
$this->validator->validate($data, new Collection(array(
|
||||
'foo' => new Optional(),
|
||||
)));
|
||||
}
|
||||
@ -266,7 +266,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolationAtSubPath');
|
||||
|
||||
$this->validator->isValid($data, new Collection(array(
|
||||
$this->validator->validate($data, new Collection(array(
|
||||
'foo' => new Optional(),
|
||||
)));
|
||||
}
|
||||
@ -288,7 +288,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$data = $this->prepareTestData($array);
|
||||
|
||||
$this->validator->isValid($data, new Collection(array(
|
||||
$this->validator->validate($data, new Collection(array(
|
||||
'foo' => new Optional($constraint),
|
||||
)));
|
||||
}
|
||||
@ -315,7 +315,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$data = $this->prepareTestData($array);
|
||||
|
||||
$this->validator->isValid($data, new Collection(array(
|
||||
$this->validator->validate($data, new Collection(array(
|
||||
'foo' => new Optional($constraints),
|
||||
)));
|
||||
}
|
||||
@ -329,7 +329,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolationAtSubPath');
|
||||
|
||||
$this->validator->isValid($data, new Collection(array(
|
||||
$this->validator->validate($data, new Collection(array(
|
||||
'foo' => new Required(),
|
||||
)));
|
||||
}
|
||||
@ -344,7 +344,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ field }}' => 'foo',
|
||||
));
|
||||
|
||||
$this->validator->isValid($data, new Collection(array(
|
||||
$this->validator->validate($data, new Collection(array(
|
||||
'fields' => array(
|
||||
'foo' => new Required(),
|
||||
),
|
||||
@ -369,7 +369,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$data = $this->prepareTestData($array);
|
||||
|
||||
$this->validator->isValid($data, new Collection(array(
|
||||
$this->validator->validate($data, new Collection(array(
|
||||
'foo' => new Required($constraint),
|
||||
)));
|
||||
}
|
||||
@ -396,7 +396,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$data = $this->prepareTestData($array);
|
||||
|
||||
$this->validator->isValid($array, new Collection(array(
|
||||
$this->validator->validate($array, new Collection(array(
|
||||
'foo' => new Required($constraints),
|
||||
)));
|
||||
}
|
||||
@ -407,7 +407,7 @@ abstract class CollectionValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'foo' => 3
|
||||
));
|
||||
|
||||
$this->validator->isValid($value, new Collection(array(
|
||||
$this->validator->validate($value, new Collection(array(
|
||||
'fields' => array(
|
||||
'foo' => new Min(2),
|
||||
)
|
||||
|
@ -39,7 +39,7 @@ class CountryValidatorTest extends LocalizedTestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Country());
|
||||
$this->validator->validate(null, new Country());
|
||||
}
|
||||
|
||||
public function testEmptyStringIsValid()
|
||||
@ -47,7 +47,7 @@ class CountryValidatorTest extends LocalizedTestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new Country());
|
||||
$this->validator->validate('', new Country());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,7 +55,7 @@ class CountryValidatorTest extends LocalizedTestCase
|
||||
*/
|
||||
public function testExpectsStringCompatibleType()
|
||||
{
|
||||
$this->validator->isValid(new \stdClass(), new Country());
|
||||
$this->validator->validate(new \stdClass(), new Country());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,7 +70,7 @@ class CountryValidatorTest extends LocalizedTestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($country, new Country());
|
||||
$this->validator->validate($country, new Country());
|
||||
}
|
||||
|
||||
public function getValidCountries()
|
||||
@ -101,7 +101,7 @@ class CountryValidatorTest extends LocalizedTestCase
|
||||
'{{ value }}' => $country,
|
||||
));
|
||||
|
||||
$this->validator->isValid($country, $constraint);
|
||||
$this->validator->validate($country, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidCountries()
|
||||
|
@ -37,7 +37,7 @@ class DateTimeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new DateTime());
|
||||
$this->validator->validate(null, new DateTime());
|
||||
}
|
||||
|
||||
public function testEmptyStringIsValid()
|
||||
@ -45,7 +45,7 @@ class DateTimeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new DateTime());
|
||||
$this->validator->validate('', new DateTime());
|
||||
}
|
||||
|
||||
public function testDateTimeClassIsValid()
|
||||
@ -53,7 +53,7 @@ class DateTimeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(new \DateTime(), new DateTime());
|
||||
$this->validator->validate(new \DateTime(), new DateTime());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,7 +61,7 @@ class DateTimeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExpectsStringCompatibleType()
|
||||
{
|
||||
$this->validator->isValid(new \stdClass(), new DateTime());
|
||||
$this->validator->validate(new \stdClass(), new DateTime());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,7 +72,7 @@ class DateTimeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($dateTime, new DateTime());
|
||||
$this->validator->validate($dateTime, new DateTime());
|
||||
}
|
||||
|
||||
public function getValidDateTimes()
|
||||
@ -99,7 +99,7 @@ class DateTimeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $dateTime,
|
||||
));
|
||||
|
||||
$this->validator->isValid($dateTime, $constraint);
|
||||
$this->validator->validate($dateTime, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidDateTimes()
|
||||
|
@ -37,7 +37,7 @@ class DateValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Date());
|
||||
$this->validator->validate(null, new Date());
|
||||
}
|
||||
|
||||
public function testEmptyStringIsValid()
|
||||
@ -45,7 +45,7 @@ class DateValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new Date());
|
||||
$this->validator->validate('', new Date());
|
||||
}
|
||||
|
||||
public function testDateTimeClassIsValid()
|
||||
@ -53,7 +53,7 @@ class DateValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(new \DateTime(), new Date());
|
||||
$this->validator->validate(new \DateTime(), new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,7 +61,7 @@ class DateValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExpectsStringCompatibleType()
|
||||
{
|
||||
$this->validator->isValid(new \stdClass(), new Date());
|
||||
$this->validator->validate(new \stdClass(), new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,7 +72,7 @@ class DateValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($date, new Date());
|
||||
$this->validator->validate($date, new Date());
|
||||
}
|
||||
|
||||
public function getValidDates()
|
||||
@ -99,7 +99,7 @@ class DateValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $date,
|
||||
));
|
||||
|
||||
$this->validator->isValid($date, $constraint);
|
||||
$this->validator->validate($date, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidDates()
|
||||
|
@ -37,7 +37,7 @@ class EmailValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Email());
|
||||
$this->validator->validate(null, new Email());
|
||||
}
|
||||
|
||||
public function testEmptyStringIsValid()
|
||||
@ -45,7 +45,7 @@ class EmailValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new Email());
|
||||
$this->validator->validate('', new Email());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ class EmailValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExpectsStringCompatibleType()
|
||||
{
|
||||
$this->validator->isValid(new \stdClass(), new Email());
|
||||
$this->validator->validate(new \stdClass(), new Email());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -64,7 +64,7 @@ class EmailValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($email, new Email());
|
||||
$this->validator->validate($email, new Email());
|
||||
}
|
||||
|
||||
public function getValidEmails()
|
||||
@ -91,7 +91,7 @@ class EmailValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $email,
|
||||
));
|
||||
|
||||
$this->validator->isValid($email, $constraint);
|
||||
$this->validator->validate($email, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidEmails()
|
||||
|
@ -37,7 +37,7 @@ class FalseValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new False());
|
||||
$this->validator->validate(null, new False());
|
||||
}
|
||||
|
||||
public function testFalseIsValid()
|
||||
@ -45,7 +45,7 @@ class FalseValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(false, new False());
|
||||
$this->validator->validate(false, new False());
|
||||
}
|
||||
|
||||
public function testTrueIsInvalid()
|
||||
@ -58,6 +58,6 @@ class FalseValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation')
|
||||
->with('myMessage', array());
|
||||
|
||||
$this->validator->isValid(true, $constraint);
|
||||
$this->validator->validate(true, $constraint);
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,6 @@ class FileValidatorPathTest extends FileValidatorTest
|
||||
'{{ file }}' => 'foobar',
|
||||
));
|
||||
|
||||
$this->validator->isValid('foobar', $constraint);
|
||||
$this->validator->validate('foobar', $constraint);
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new File());
|
||||
$this->validator->validate(null, new File());
|
||||
}
|
||||
|
||||
public function testEmptyStringIsValid()
|
||||
@ -59,7 +59,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new File());
|
||||
$this->validator->validate('', new File());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,7 +67,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExpectsStringCompatibleTypeOrFile()
|
||||
{
|
||||
$this->validator->isValid(new \stdClass(), new File());
|
||||
$this->validator->validate(new \stdClass(), new File());
|
||||
}
|
||||
|
||||
public function testValidFile()
|
||||
@ -75,7 +75,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($this->path, new File());
|
||||
$this->validator->validate($this->path, new File());
|
||||
}
|
||||
|
||||
public function testValidUploadedfile()
|
||||
@ -84,7 +84,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation');
|
||||
|
||||
$file = new UploadedFile($this->path, 'originalName');
|
||||
$this->validator->isValid($file, new File());
|
||||
$this->validator->validate($file, new File());
|
||||
}
|
||||
|
||||
public function testTooLargeBytes()
|
||||
@ -104,7 +104,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ file }}' => $this->path,
|
||||
));
|
||||
|
||||
$this->validator->isValid($this->getFile($this->path), $constraint);
|
||||
$this->validator->validate($this->getFile($this->path), $constraint);
|
||||
}
|
||||
|
||||
public function testTooLargeKiloBytes()
|
||||
@ -124,7 +124,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ file }}' => $this->path,
|
||||
));
|
||||
|
||||
$this->validator->isValid($this->getFile($this->path), $constraint);
|
||||
$this->validator->validate($this->getFile($this->path), $constraint);
|
||||
}
|
||||
|
||||
public function testTooLargeMegaBytes()
|
||||
@ -144,7 +144,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ file }}' => $this->path,
|
||||
));
|
||||
|
||||
$this->validator->isValid($this->getFile($this->path), $constraint);
|
||||
$this->validator->validate($this->getFile($this->path), $constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,7 +156,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'maxSize' => '1abc',
|
||||
));
|
||||
|
||||
$this->validator->isValid($this->path, $constraint);
|
||||
$this->validator->validate($this->path, $constraint);
|
||||
}
|
||||
|
||||
public function testValidMimeType()
|
||||
@ -184,7 +184,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'mimeTypes' => array('image/png', 'image/jpg'),
|
||||
));
|
||||
|
||||
$this->validator->isValid($file, $constraint);
|
||||
$this->validator->validate($file, $constraint);
|
||||
}
|
||||
|
||||
public function testValidWildcardMimeType()
|
||||
@ -212,7 +212,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'mimeTypes' => array('image/*'),
|
||||
));
|
||||
|
||||
$this->validator->isValid($file, $constraint);
|
||||
$this->validator->validate($file, $constraint);
|
||||
}
|
||||
|
||||
public function testInvalidMimeType()
|
||||
@ -246,7 +246,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ file }}' => $this->path,
|
||||
));
|
||||
|
||||
$this->validator->isValid($file, $constraint);
|
||||
$this->validator->validate($file, $constraint);
|
||||
}
|
||||
|
||||
public function testInvalidWildcardMimeType()
|
||||
@ -280,7 +280,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ file }}' => $this->path,
|
||||
));
|
||||
|
||||
$this->validator->isValid($file, $constraint);
|
||||
$this->validator->validate($file, $constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -298,7 +298,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation')
|
||||
->with('myMessage', $params);
|
||||
|
||||
$this->validator->isValid($file, $constraint);
|
||||
$this->validator->validate($file, $constraint);
|
||||
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ class ImageValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Image());
|
||||
$this->validator->validate(null, new Image());
|
||||
}
|
||||
|
||||
public function testEmptyStringIsValid()
|
||||
@ -42,7 +42,7 @@ class ImageValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new Image());
|
||||
$this->validator->validate('', new Image());
|
||||
}
|
||||
|
||||
public function testValidImage()
|
||||
@ -54,7 +54,7 @@ class ImageValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($this->image, new Image());
|
||||
$this->validator->validate($this->image, new Image());
|
||||
}
|
||||
|
||||
public function testValidSize()
|
||||
@ -73,7 +73,7 @@ class ImageValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'maxHeight' => 2,
|
||||
));
|
||||
|
||||
$this->validator->isValid($this->image, $constraint);
|
||||
$this->validator->validate($this->image, $constraint);
|
||||
}
|
||||
|
||||
public function testWidthTooSmall()
|
||||
@ -94,7 +94,7 @@ class ImageValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ min_width }}' => '3',
|
||||
));
|
||||
|
||||
$this->validator->isValid($this->image, $constraint);
|
||||
$this->validator->validate($this->image, $constraint);
|
||||
}
|
||||
|
||||
public function testWidthTooBig()
|
||||
@ -115,7 +115,7 @@ class ImageValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ max_width }}' => '1',
|
||||
));
|
||||
|
||||
$this->validator->isValid($this->image, $constraint);
|
||||
$this->validator->validate($this->image, $constraint);
|
||||
}
|
||||
|
||||
public function testHeightTooSmall()
|
||||
@ -136,7 +136,7 @@ class ImageValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ min_height }}' => '3',
|
||||
));
|
||||
|
||||
$this->validator->isValid($this->image, $constraint);
|
||||
$this->validator->validate($this->image, $constraint);
|
||||
}
|
||||
|
||||
public function testHeightTooBig()
|
||||
@ -157,7 +157,7 @@ class ImageValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ max_height }}' => '1',
|
||||
));
|
||||
|
||||
$this->validator->isValid($this->image, $constraint);
|
||||
$this->validator->validate($this->image, $constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -173,7 +173,7 @@ class ImageValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'minWidth' => '1abc',
|
||||
));
|
||||
|
||||
$this->validator->isValid($this->image, $constraint);
|
||||
$this->validator->validate($this->image, $constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -189,7 +189,7 @@ class ImageValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'maxWidth' => '1abc',
|
||||
));
|
||||
|
||||
$this->validator->isValid($this->image, $constraint);
|
||||
$this->validator->validate($this->image, $constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -205,7 +205,7 @@ class ImageValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'minHeight' => '1abc',
|
||||
));
|
||||
|
||||
$this->validator->isValid($this->image, $constraint);
|
||||
$this->validator->validate($this->image, $constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -221,6 +221,6 @@ class ImageValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'maxHeight' => '1abc',
|
||||
));
|
||||
|
||||
$this->validator->isValid($this->image, $constraint);
|
||||
$this->validator->validate($this->image, $constraint);
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Ip());
|
||||
$this->validator->validate(null, new Ip());
|
||||
}
|
||||
|
||||
public function testEmptyStringIsValid()
|
||||
@ -45,7 +45,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new Ip());
|
||||
$this->validator->validate('', new Ip());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExpectsStringCompatibleType()
|
||||
{
|
||||
$this->validator->isValid(new \stdClass(), new Ip());
|
||||
$this->validator->validate(new \stdClass(), new Ip());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,7 +74,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($ip, new Ip(array(
|
||||
$this->validator->validate($ip, new Ip(array(
|
||||
'version' => Ip::V4,
|
||||
)));
|
||||
}
|
||||
@ -101,7 +101,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($ip, new Ip(array(
|
||||
$this->validator->validate($ip, new Ip(array(
|
||||
'version' => Ip::V6,
|
||||
)));
|
||||
}
|
||||
@ -139,7 +139,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($ip, new Ip(array(
|
||||
$this->validator->validate($ip, new Ip(array(
|
||||
'version' => Ip::ALL,
|
||||
)));
|
||||
}
|
||||
@ -165,7 +165,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $ip,
|
||||
));
|
||||
|
||||
$this->validator->isValid($ip, $constraint);
|
||||
$this->validator->validate($ip, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidIpsV4()
|
||||
@ -199,7 +199,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $ip,
|
||||
));
|
||||
|
||||
$this->validator->isValid($ip, $constraint);
|
||||
$this->validator->validate($ip, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidPrivateIpsV4()
|
||||
@ -227,7 +227,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $ip,
|
||||
));
|
||||
|
||||
$this->validator->isValid($ip, $constraint);
|
||||
$this->validator->validate($ip, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidReservedIpsV4()
|
||||
@ -255,7 +255,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $ip,
|
||||
));
|
||||
|
||||
$this->validator->isValid($ip, $constraint);
|
||||
$this->validator->validate($ip, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidPublicIpsV4()
|
||||
@ -279,7 +279,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $ip,
|
||||
));
|
||||
|
||||
$this->validator->isValid($ip, $constraint);
|
||||
$this->validator->validate($ip, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidIpsV6()
|
||||
@ -317,7 +317,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $ip,
|
||||
));
|
||||
|
||||
$this->validator->isValid($ip, $constraint);
|
||||
$this->validator->validate($ip, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidPrivateIpsV6()
|
||||
@ -345,7 +345,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $ip,
|
||||
));
|
||||
|
||||
$this->validator->isValid($ip, $constraint);
|
||||
$this->validator->validate($ip, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidReservedIpsV6()
|
||||
@ -372,7 +372,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $ip,
|
||||
));
|
||||
|
||||
$this->validator->isValid($ip, $constraint);
|
||||
$this->validator->validate($ip, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidPublicIpsV6()
|
||||
@ -396,7 +396,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $ip,
|
||||
));
|
||||
|
||||
$this->validator->isValid($ip, $constraint);
|
||||
$this->validator->validate($ip, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidIpsAll()
|
||||
@ -420,7 +420,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $ip,
|
||||
));
|
||||
|
||||
$this->validator->isValid($ip, $constraint);
|
||||
$this->validator->validate($ip, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidPrivateIpsAll()
|
||||
@ -444,7 +444,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $ip,
|
||||
));
|
||||
|
||||
$this->validator->isValid($ip, $constraint);
|
||||
$this->validator->validate($ip, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidReservedIpsAll()
|
||||
@ -468,7 +468,7 @@ class IpValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $ip,
|
||||
));
|
||||
|
||||
$this->validator->isValid($ip, $constraint);
|
||||
$this->validator->validate($ip, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidPublicIpsAll()
|
||||
|
@ -39,7 +39,7 @@ class LanguageValidatorTest extends LocalizedTestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Language());
|
||||
$this->validator->validate(null, new Language());
|
||||
}
|
||||
|
||||
public function testEmptyStringIsValid()
|
||||
@ -47,7 +47,7 @@ class LanguageValidatorTest extends LocalizedTestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new Language());
|
||||
$this->validator->validate('', new Language());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,7 +55,7 @@ class LanguageValidatorTest extends LocalizedTestCase
|
||||
*/
|
||||
public function testExpectsStringCompatibleType()
|
||||
{
|
||||
$this->validator->isValid(new \stdClass(), new Language());
|
||||
$this->validator->validate(new \stdClass(), new Language());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,7 +70,7 @@ class LanguageValidatorTest extends LocalizedTestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($language, new Language());
|
||||
$this->validator->validate($language, new Language());
|
||||
}
|
||||
|
||||
public function getValidLanguages()
|
||||
@ -101,7 +101,7 @@ class LanguageValidatorTest extends LocalizedTestCase
|
||||
'{{ value }}' => $language,
|
||||
));
|
||||
|
||||
$this->validator->isValid($language, $constraint);
|
||||
$this->validator->validate($language, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidLanguages()
|
||||
|
@ -39,7 +39,7 @@ class LocaleValidatorTest extends LocalizedTestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Locale());
|
||||
$this->validator->validate(null, new Locale());
|
||||
}
|
||||
|
||||
public function testEmptyStringIsValid()
|
||||
@ -47,7 +47,7 @@ class LocaleValidatorTest extends LocalizedTestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new Locale());
|
||||
$this->validator->validate('', new Locale());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,7 +55,7 @@ class LocaleValidatorTest extends LocalizedTestCase
|
||||
*/
|
||||
public function testExpectsStringCompatibleType()
|
||||
{
|
||||
$this->validator->isValid(new \stdClass(), new Locale());
|
||||
$this->validator->validate(new \stdClass(), new Locale());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,7 +70,7 @@ class LocaleValidatorTest extends LocalizedTestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($locale, new Locale());
|
||||
$this->validator->validate($locale, new Locale());
|
||||
}
|
||||
|
||||
public function getValidLocales()
|
||||
@ -102,7 +102,7 @@ class LocaleValidatorTest extends LocalizedTestCase
|
||||
'{{ value }}' => $locale,
|
||||
));
|
||||
|
||||
$this->validator->isValid($locale, $constraint);
|
||||
$this->validator->validate($locale, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidLocales()
|
||||
|
@ -37,7 +37,7 @@ class MaxLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new MaxLength(array('limit' => 5)));
|
||||
$this->validator->validate(null, new MaxLength(array('limit' => 5)));
|
||||
}
|
||||
|
||||
public function testEmptyStringIsValid()
|
||||
@ -45,7 +45,7 @@ class MaxLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new MaxLength(array('limit' => 5)));
|
||||
$this->validator->validate('', new MaxLength(array('limit' => 5)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ class MaxLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExpectsStringCompatibleType()
|
||||
{
|
||||
$this->validator->isValid(new \stdClass(), new MaxLength(array('limit' => 5)));
|
||||
$this->validator->validate(new \stdClass(), new MaxLength(array('limit' => 5)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,7 +69,7 @@ class MaxLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation');
|
||||
|
||||
$constraint = new MaxLength(array('limit' => 5));
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getValidValues()
|
||||
@ -103,7 +103,7 @@ class MaxLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ limit }}' => 5,
|
||||
), null, 5);
|
||||
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidValues()
|
||||
|
@ -37,7 +37,7 @@ class MaxValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Max(array('limit' => 10)));
|
||||
$this->validator->validate(null, new Max(array('limit' => 10)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -49,7 +49,7 @@ class MaxValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation');
|
||||
|
||||
$constraint = new Max(array('limit' => 10));
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getValidValues()
|
||||
@ -80,7 +80,7 @@ class MaxValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ limit }}' => 10,
|
||||
));
|
||||
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidValues()
|
||||
|
@ -37,7 +37,7 @@ class MinLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new MinLength(array('limit' => 6)));
|
||||
$this->validator->validate(null, new MinLength(array('limit' => 6)));
|
||||
}
|
||||
|
||||
public function testEmptyStringIsValid()
|
||||
@ -45,7 +45,7 @@ class MinLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new MinLength(array('limit' => 6)));
|
||||
$this->validator->validate('', new MinLength(array('limit' => 6)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ class MinLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExpectsStringCompatibleType()
|
||||
{
|
||||
$this->validator->isValid(new \stdClass(), new MinLength(array('limit' => 5)));
|
||||
$this->validator->validate(new \stdClass(), new MinLength(array('limit' => 5)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,7 +69,7 @@ class MinLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation');
|
||||
|
||||
$constraint = new MinLength(array('limit' => 6));
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getValidValues()
|
||||
@ -103,7 +103,7 @@ class MinLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ limit }}' => 5,
|
||||
), null, 5);
|
||||
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidValues()
|
||||
|
@ -31,7 +31,7 @@ class MinValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Min(array('limit' => 10)));
|
||||
$this->validator->validate(null, new Min(array('limit' => 10)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -43,7 +43,7 @@ class MinValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation');
|
||||
|
||||
$constraint = new Min(array('limit' => 10));
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getValidValues()
|
||||
@ -74,7 +74,7 @@ class MinValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ limit }}' => 10,
|
||||
));
|
||||
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidValues()
|
||||
|
@ -40,7 +40,7 @@ class NotBlankValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($date, new NotBlank());
|
||||
$this->validator->validate($date, new NotBlank());
|
||||
}
|
||||
|
||||
public function getValidValues()
|
||||
@ -64,7 +64,7 @@ class NotBlankValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation')
|
||||
->with('myMessage');
|
||||
|
||||
$this->validator->isValid(null, $constraint);
|
||||
$this->validator->validate(null, $constraint);
|
||||
}
|
||||
|
||||
public function testBlankIsInvalid()
|
||||
@ -77,7 +77,7 @@ class NotBlankValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation')
|
||||
->with('myMessage');
|
||||
|
||||
$this->validator->isValid('', $constraint);
|
||||
$this->validator->validate('', $constraint);
|
||||
}
|
||||
|
||||
public function testFalseIsInvalid()
|
||||
@ -90,7 +90,7 @@ class NotBlankValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation')
|
||||
->with('myMessage');
|
||||
|
||||
$this->validator->isValid(false, $constraint);
|
||||
$this->validator->validate(false, $constraint);
|
||||
}
|
||||
|
||||
public function testEmptyArrayIsInvalid()
|
||||
@ -103,7 +103,7 @@ class NotBlankValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation')
|
||||
->with('myMessage');
|
||||
|
||||
$this->validator->isValid(array(), $constraint);
|
||||
$this->validator->validate(array(), $constraint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ class NotNullValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($value, new NotNull());
|
||||
$this->validator->validate($value, new NotNull());
|
||||
}
|
||||
|
||||
public function getValidValues()
|
||||
@ -64,6 +64,6 @@ class NotNullValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->with('myMessage', array(
|
||||
));
|
||||
|
||||
$this->validator->isValid(null, $constraint);
|
||||
$this->validator->validate(null, $constraint);
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class NullValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Null());
|
||||
$this->validator->validate(null, new Null());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,7 +55,7 @@ class NullValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $value,
|
||||
));
|
||||
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidValues()
|
||||
|
@ -37,7 +37,7 @@ class RegexValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Regex(array('pattern' => '/^[0-9]+$/')));
|
||||
$this->validator->validate(null, new Regex(array('pattern' => '/^[0-9]+$/')));
|
||||
}
|
||||
|
||||
public function testEmptyStringIsValid()
|
||||
@ -45,7 +45,7 @@ class RegexValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new Regex(array('pattern' => '/^[0-9]+$/')));
|
||||
$this->validator->validate('', new Regex(array('pattern' => '/^[0-9]+$/')));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ class RegexValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExpectsStringCompatibleType()
|
||||
{
|
||||
$this->validator->isValid(new \stdClass(), new Regex(array('pattern' => '/^[0-9]+$/')));
|
||||
$this->validator->validate(new \stdClass(), new Regex(array('pattern' => '/^[0-9]+$/')));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,7 +65,7 @@ class RegexValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation');
|
||||
|
||||
$constraint = new Regex(array('pattern' => '/^[0-9]+$/'));
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getValidValues()
|
||||
@ -94,7 +94,7 @@ class RegexValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $value,
|
||||
));
|
||||
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidValues()
|
||||
|
@ -37,7 +37,7 @@ class SizeLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new SizeLength(array('min' => 6, 'max' => 10)));
|
||||
$this->validator->validate(null, new SizeLength(array('min' => 6, 'max' => 10)));
|
||||
}
|
||||
|
||||
public function testEmptyStringIsValid()
|
||||
@ -45,7 +45,7 @@ class SizeLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new SizeLength(array('min' => 6, 'max' => 10)));
|
||||
$this->validator->validate('', new SizeLength(array('min' => 6, 'max' => 10)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ class SizeLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExpectsStringCompatibleType()
|
||||
{
|
||||
$this->validator->isValid(new \stdClass(), new SizeLength(array('min' => 6, 'max' => 10)));
|
||||
$this->validator->validate(new \stdClass(), new SizeLength(array('min' => 6, 'max' => 10)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,7 +69,7 @@ class SizeLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation');
|
||||
|
||||
$constraint = new SizeLength(array('min' => 6, 'max' => 10));
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getValidValues()
|
||||
@ -99,7 +99,7 @@ class SizeLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation');
|
||||
|
||||
$constraint = new SizeLength(array('min' => 6, 'max' => 10));
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidValues()
|
||||
@ -131,7 +131,7 @@ class SizeLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ limit }}' => 5,
|
||||
), null, 5);
|
||||
|
||||
$this->validator->isValid('1234', $constraint);
|
||||
$this->validator->validate('1234', $constraint);
|
||||
}
|
||||
|
||||
public function testMaxMessageIsSet()
|
||||
@ -149,7 +149,7 @@ class SizeLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ limit }}' => 10,
|
||||
), null, 10);
|
||||
|
||||
$this->validator->isValid('12345678901', $constraint);
|
||||
$this->validator->validate('12345678901', $constraint);
|
||||
}
|
||||
|
||||
public function testExactMessageIsSet()
|
||||
@ -167,6 +167,6 @@ class SizeLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ limit }}' => 5,
|
||||
), null, 5);
|
||||
|
||||
$this->validator->isValid('1234', $constraint);
|
||||
$this->validator->validate('1234', $constraint);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class SizeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Size(array('min' => 10, 'max' => 20)));
|
||||
$this->validator->validate(null, new Size(array('min' => 10, 'max' => 20)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -43,7 +43,7 @@ class SizeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation');
|
||||
|
||||
$constraint = new Size(array('min' => 10, 'max' => 20));
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getValidValues()
|
||||
@ -69,7 +69,7 @@ class SizeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addViolation');
|
||||
|
||||
$constraint = new Size(array('min' => 10, 'max' => 20));
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidValues()
|
||||
@ -98,7 +98,7 @@ class SizeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ limit }}' => 10,
|
||||
));
|
||||
|
||||
$this->validator->isValid(9, $constraint);
|
||||
$this->validator->validate(9, $constraint);
|
||||
}
|
||||
|
||||
public function testMaxMessageIsSet()
|
||||
@ -116,6 +116,6 @@ class SizeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ limit }}' => 20,
|
||||
));
|
||||
|
||||
$this->validator->isValid(21, $constraint);
|
||||
$this->validator->validate(21, $constraint);
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class TimeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Time());
|
||||
$this->validator->validate(null, new Time());
|
||||
}
|
||||
|
||||
public function testEmptyStringIsValid()
|
||||
@ -45,7 +45,7 @@ class TimeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new Time());
|
||||
$this->validator->validate('', new Time());
|
||||
}
|
||||
|
||||
public function testDateTimeClassIsValid()
|
||||
@ -53,7 +53,7 @@ class TimeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(new \DateTime(), new Time());
|
||||
$this->validator->validate(new \DateTime(), new Time());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,7 +61,7 @@ class TimeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExpectsStringCompatibleType()
|
||||
{
|
||||
$this->validator->isValid(new \stdClass(), new Time());
|
||||
$this->validator->validate(new \stdClass(), new Time());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,7 +72,7 @@ class TimeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($time, new Time());
|
||||
$this->validator->validate($time, new Time());
|
||||
}
|
||||
|
||||
public function getValidTimes()
|
||||
@ -99,7 +99,7 @@ class TimeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $time,
|
||||
));
|
||||
|
||||
$this->validator->isValid($time, $constraint);
|
||||
$this->validator->validate($time, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidTimes()
|
||||
|
@ -37,7 +37,7 @@ class TrueValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new True());
|
||||
$this->validator->validate(null, new True());
|
||||
}
|
||||
|
||||
public function testTrueIsValid()
|
||||
@ -45,7 +45,7 @@ class TrueValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(true, new True());
|
||||
$this->validator->validate(true, new True());
|
||||
}
|
||||
|
||||
public function testFalseIsInvalid()
|
||||
@ -59,6 +59,6 @@ class TrueValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->with('myMessage', array(
|
||||
));
|
||||
|
||||
$this->validator->isValid(false, $constraint);
|
||||
$this->validator->validate(false, $constraint);
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class TypeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Type(array('type' => 'integer')));
|
||||
$this->validator->validate(null, new Type(array('type' => 'integer')));
|
||||
}
|
||||
|
||||
public function testEmptyIsValidIfString()
|
||||
@ -47,12 +47,12 @@ class TypeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new Type(array('type' => 'string')));
|
||||
$this->validator->validate('', new Type(array('type' => 'string')));
|
||||
}
|
||||
|
||||
public function testEmptyIsInvalidIfNoString()
|
||||
{
|
||||
$this->validator->isValid('', new Type(array('type' => 'integer')));
|
||||
$this->validator->validate('', new Type(array('type' => 'integer')));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,7 +65,7 @@ class TypeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$constraint = new Type(array('type' => $type));
|
||||
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getValidValues()
|
||||
@ -122,7 +122,7 @@ class TypeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ type }}' => $type,
|
||||
));
|
||||
|
||||
$this->validator->isValid($value, $constraint);
|
||||
$this->validator->validate($value, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidValues()
|
||||
|
@ -37,7 +37,7 @@ class UrlValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid(null, new Url());
|
||||
$this->validator->validate(null, new Url());
|
||||
}
|
||||
|
||||
public function testEmptyStringIsValid()
|
||||
@ -45,7 +45,7 @@ class UrlValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid('', new Url());
|
||||
$this->validator->validate('', new Url());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ class UrlValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExpectsStringCompatibleType()
|
||||
{
|
||||
$this->validator->isValid(new \stdClass(), new Url());
|
||||
$this->validator->validate(new \stdClass(), new Url());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -64,7 +64,7 @@ class UrlValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
||||
$this->validator->isValid($url, new Url());
|
||||
$this->validator->validate($url, new Url());
|
||||
}
|
||||
|
||||
public function getValidUrls()
|
||||
@ -119,7 +119,7 @@ class UrlValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'{{ value }}' => $url,
|
||||
));
|
||||
|
||||
$this->validator->isValid($url, $constraint);
|
||||
$this->validator->validate($url, $constraint);
|
||||
}
|
||||
|
||||
public function getInvalidUrls()
|
||||
@ -154,7 +154,7 @@ class UrlValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
'protocols' => array('ftp', 'file', 'git')
|
||||
));
|
||||
|
||||
$this->validator->isValid($url, $constraint);
|
||||
$this->validator->validate($url, $constraint);
|
||||
}
|
||||
|
||||
public function getValidCustomUrls()
|
||||
|
@ -26,7 +26,7 @@ class ConstraintAValidator extends ConstraintValidator
|
||||
self::$passedContext = $context;
|
||||
}
|
||||
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if ('VALID' != $value) {
|
||||
$this->context->addViolation('message', array('param' => 'value'));
|
||||
|
@ -16,7 +16,7 @@ use Symfony\Component\Validator\ConstraintValidator;
|
||||
|
||||
class FailingConstraintValidator extends ConstraintValidator
|
||||
{
|
||||
public function isValid($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
$this->context->addViolation($constraint->message, array());
|
||||
|
||||
|
Reference in New Issue
Block a user