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