Skip to content

Commit cd5c7aa

Browse files
committed
[Validator] remove deprecated features
1 parent 79bc327 commit cd5c7aa

File tree

8 files changed

+8
-70
lines changed

8 files changed

+8
-70
lines changed

src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@
3131
use Symfony\Bridge\Doctrine\Tests\Fixtures\Type\StringWrapper;
3232
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
3333
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator;
34-
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
34+
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
3535
use Doctrine\ORM\Tools\SchemaTool;
3636

3737
/**
3838
* @author Bernhard Schussek <bschussek@gmail.com>
39-
*
40-
* @todo use ConstraintValidatorTestCase when symfony/validator ~3.2 is required.
4139
*/
42-
class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
40+
class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
4341
{
4442
const EM_NAME = 'foo';
4543

src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@
2222
use Symfony\Component\Validator\Constraints\NotNull;
2323
use Symfony\Component\Validator\Constraints\NotBlank;
2424
use Symfony\Component\Validator\Constraints\Valid;
25-
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
25+
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
2626

2727
/**
2828
* @author Bernhard Schussek <bschussek@gmail.com>
29-
*
30-
* @todo use ConstraintValidatorTestCase when symfony/validator ~3.2 is required.
3129
*/
32-
class FormValidatorTest extends AbstractConstraintValidatorTest
30+
class FormValidatorTest extends ConstraintValidatorTestCase
3331
{
3432
/**
3533
* @var \PHPUnit_Framework_MockObject_MockObject

src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
1717
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
1818
use Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator;
19-
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
19+
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
2020

2121
/**
2222
* @author Bernhard Schussek <bschussek@gmail.com>
2323
*/
24-
abstract class UserPasswordValidatorTest extends AbstractConstraintValidatorTest
24+
abstract class UserPasswordValidatorTest extends ConstraintValidatorTestCase
2525
{
2626
const PASSWORD = 's3Cr3t';
2727

src/Symfony/Component/Validator/Constraints/Choice.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Choice extends Constraint
3434
public $choices;
3535
public $callback;
3636
public $multiple = false;
37-
public $strict = false;
37+
public $strict = true;
3838
public $min;
3939
public $max;
4040
public $message = 'The value you selected is not a valid choice.';

src/Symfony/Component/Validator/Constraints/ChoiceValidator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function validate($value, Constraint $constraint)
5959
}
6060

6161
if (false === $constraint->strict) {
62-
@trigger_error('Setting the strict option of the Choice constraint to false is deprecated since version 3.2 and will be removed in 4.0.', E_USER_DEPRECATED);
62+
throw new \RuntimeException('The "strict" option of the Choice constraint should not be used.');
6363
}
6464

6565
if ($constraint->multiple) {

src/Symfony/Component/Validator/Constraints/DateTimeValidator.php

-5
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020
*/
2121
class DateTimeValidator extends DateValidator
2222
{
23-
/**
24-
* @deprecated since version 3.1, to be removed in 4.0.
25-
*/
26-
const PATTERN = '/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/';
27-
2823
/**
2924
* {@inheritdoc}
3025
*/

src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php

-21
This file was deleted.

src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php

-32
Original file line numberDiff line numberDiff line change
@@ -262,22 +262,6 @@ public function testTooManyChoices()
262262
->assertRaised();
263263
}
264264

265-
/**
266-
* @group legacy
267-
*/
268-
public function testNonStrict()
269-
{
270-
$constraint = new Choice(array(
271-
'choices' => array(1, 2),
272-
'strict' => false,
273-
));
274-
275-
$this->validator->validate('2', $constraint);
276-
$this->validator->validate(2, $constraint);
277-
278-
$this->assertNoViolation();
279-
}
280-
281265
public function testStrictAllowsExactValue()
282266
{
283267
$constraint = new Choice(array(
@@ -306,22 +290,6 @@ public function testStrictDisallowsDifferentType()
306290
->assertRaised();
307291
}
308292

309-
/**
310-
* @group legacy
311-
*/
312-
public function testNonStrictWithMultipleChoices()
313-
{
314-
$constraint = new Choice(array(
315-
'choices' => array(1, 2, 3),
316-
'multiple' => true,
317-
'strict' => false,
318-
));
319-
320-
$this->validator->validate(array('2', 3), $constraint);
321-
322-
$this->assertNoViolation();
323-
}
324-
325293
public function testStrictWithMultipleChoices()
326294
{
327295
$constraint = new Choice(array(

0 commit comments

Comments
 (0)