Skip to content

Commit

Permalink
Change deprecated Min constraint to Range constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu committed Jan 15, 2013
1 parent a39fdd8 commit c80c17e
Showing 1 changed file with 16 additions and 16 deletions.
Expand Up @@ -12,7 +12,7 @@
namespace Symfony\Component\Validator\Tests\Constraints;

use Symfony\Component\Validator\ExecutionContext;
use Symfony\Component\Validator\Constraints\Min;
use Symfony\Component\Validator\Constraints\Range;
use Symfony\Component\Validator\Constraints\NotNull;
use Symfony\Component\Validator\Constraints\Collection\Required;
use Symfony\Component\Validator\Constraints\Collection\Optional;
Expand Down Expand Up @@ -60,7 +60,7 @@ public function testNullIsValid()
->method('addViolationAt');

$this->validator->validate(null, new Collection(array('fields' => array(
'foo' => new Min(4),
'foo' => new Range(array('min' => 4)),
))));

restore_error_handler();
Expand All @@ -76,7 +76,7 @@ public function testFieldsAsDefaultOption()
->method('addViolationAt');

$this->validator->validate($data, new Collection(array(
'foo' => new Min(4),
'foo' => new Range(array('min' => 4)),
)));

restore_error_handler();
Expand All @@ -90,7 +90,7 @@ public function testThrowsExceptionIfNotTraversable()
set_error_handler(array($this, "deprecationErrorHandler"));

$this->validator->validate('foobar', new Collection(array('fields' => array(
'foo' => new Min(4),
'foo' => new Range(array('min' => 4)),
))));

restore_error_handler();
Expand All @@ -99,7 +99,7 @@ public function testThrowsExceptionIfNotTraversable()
public function testWalkSingleConstraint()
{
set_error_handler(array($this, "deprecationErrorHandler"));
$constraint = new Min(4);
$constraint = new Range(array('min' => 4));
restore_error_handler();

$array = array(
Expand Down Expand Up @@ -131,7 +131,7 @@ public function testWalkMultipleConstraints()
{
set_error_handler(array($this, "deprecationErrorHandler"));
$constraints = array(
new Min(4),
new Range(array('min' => 4)),
new NotNull(),
);
restore_error_handler();
Expand Down Expand Up @@ -180,7 +180,7 @@ public function testExtraFieldsDisallowed()

$this->validator->validate($data, new Collection(array(
'fields' => array(
'foo' => new Min(4),
'foo' => new Range(array('min' => 4)),
),
'extraFieldsMessage' => 'myMessage',
)));
Expand All @@ -199,7 +199,7 @@ public function testNullNotConsideredExtraField()

$constraint = new Collection(array(
'fields' => array(
'foo' => new Min(4),
'foo' => new Range(array('min' => 4)),
),
));

Expand All @@ -222,7 +222,7 @@ public function testExtraFieldsAllowed()

$constraint = new Collection(array(
'fields' => array(
'foo' => new Min(4),
'foo' => new Range(array('min' => 4)),
),
'allowExtraFields' => true,
));
Expand All @@ -243,7 +243,7 @@ public function testMissingFieldsDisallowed()

$constraint = new Collection(array(
'fields' => array(
'foo' => new Min(4),
'foo' => new Range(array('min' => 4)),
),
'missingFieldsMessage' => 'myMessage',
));
Expand All @@ -267,7 +267,7 @@ public function testMissingFieldsAllowed()

$constraint = new Collection(array(
'fields' => array(
'foo' => new Min(4),
'foo' => new Range(array('min' => 4)),
),
'allowMissingFields' => true,
));
Expand Down Expand Up @@ -314,7 +314,7 @@ public function testOptionalFieldSingleConstraint()
'foo' => 5,
);

$constraint = new Min(4);
$constraint = new Range(array('min' => 4));

$this->context->expects($this->once())
->method('validateValue')
Expand Down Expand Up @@ -342,7 +342,7 @@ public function testOptionalFieldMultipleConstraints()

$constraints = array(
new NotNull(),
new Min(4),
new Range(array('min' => 4)),
);
$i = 1;

Expand Down Expand Up @@ -404,7 +404,7 @@ public function testRequiredFieldSingleConstraint()
'foo' => 5,
);

$constraint = new Min(4);
$constraint = new Range(array('min' => 4));

$this->context->expects($this->once())
->method('validateValue')
Expand Down Expand Up @@ -432,7 +432,7 @@ public function testRequiredFieldMultipleConstraints()

$constraints = array(
new NotNull(),
new Min(4),
new Range(array('min' => 4)),
);
$i = 1;

Expand Down Expand Up @@ -464,7 +464,7 @@ public function testObjectShouldBeLeftUnchanged()

$this->validator->validate($value, new Collection(array(
'fields' => array(
'foo' => new Min(2),
'foo' => new Range(array('min' => 2)),
)
)));

Expand Down

0 comments on commit c80c17e

Please sign in to comment.