Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / validator / Tests / Constraints / IsFalseValidatorTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\Validator\Tests\Constraints;
13
14 use Symfony\Component\Validator\Constraints\IsFalse;
15 use Symfony\Component\Validator\Constraints\IsFalseValidator;
16 use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
17
18 class IsFalseValidatorTest extends ConstraintValidatorTestCase
19 {
20     protected function createValidator()
21     {
22         return new IsFalseValidator();
23     }
24
25     public function testNullIsValid()
26     {
27         $this->validator->validate(null, new IsFalse());
28
29         $this->assertNoViolation();
30     }
31
32     public function testFalseIsValid()
33     {
34         $this->validator->validate(false, new IsFalse());
35
36         $this->assertNoViolation();
37     }
38
39     public function testTrueIsInvalid()
40     {
41         $constraint = new IsFalse(array(
42             'message' => 'myMessage',
43         ));
44
45         $this->validator->validate(true, $constraint);
46
47         $this->buildViolation('myMessage')
48             ->setParameter('{{ value }}', 'true')
49             ->setCode(IsFalse::NOT_FALSE_ERROR)
50             ->assertRaised();
51     }
52 }