Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / symfony / validator / Tests / Constraints / BlankValidatorTest.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\Blank;
15 use Symfony\Component\Validator\Constraints\BlankValidator;
16 use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
17
18 class BlankValidatorTest extends ConstraintValidatorTestCase
19 {
20     protected function createValidator()
21     {
22         return new BlankValidator();
23     }
24
25     public function testNullIsValid()
26     {
27         $this->validator->validate(null, new Blank());
28
29         $this->assertNoViolation();
30     }
31
32     public function testBlankIsValid()
33     {
34         $this->validator->validate('', new Blank());
35
36         $this->assertNoViolation();
37     }
38
39     /**
40      * @dataProvider getInvalidValues
41      */
42     public function testInvalidValues($value, $valueAsString)
43     {
44         $constraint = new Blank(array(
45             'message' => 'myMessage',
46         ));
47
48         $this->validator->validate($value, $constraint);
49
50         $this->buildViolation('myMessage')
51             ->setParameter('{{ value }}', $valueAsString)
52             ->setCode(Blank::NOT_BLANK_ERROR)
53             ->assertRaised();
54     }
55
56     public function getInvalidValues()
57     {
58         return array(
59             array('foobar', '"foobar"'),
60             array(0, '0'),
61             array(false, 'false'),
62             array(1234, '1234'),
63         );
64     }
65 }