minor #32404 [Validator] remove tests for legacy behaviour (xabbuh)
This PR was merged into the 5.0-dev branch.
Discussion
----------
[Validator] remove tests for legacy behaviour
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
d6d4abaa03
remove tests for legacy behaviour
This commit is contained in:
commit
d17b333461
@ -84,7 +84,7 @@ class ConstraintViolation implements ConstraintViolationInterface
|
|||||||
$class .= '.';
|
$class .= '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('' !== $code = (string) $this->code) {
|
if (null !== $this->code && '' !== $code = $this->code) {
|
||||||
$code = ' (code '.$code.')';
|
$code = ' (code '.$code.')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,20 +108,4 @@ EOF;
|
|||||||
|
|
||||||
$this->assertSame($expected, (string) $violation);
|
$this->assertSame($expected, (string) $violation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNonStringCode()
|
|
||||||
{
|
|
||||||
$violation = new ConstraintViolation(
|
|
||||||
'42 cannot be used here',
|
|
||||||
'this is the message template',
|
|
||||||
[],
|
|
||||||
['some_value' => 42],
|
|
||||||
'some_value',
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
42
|
|
||||||
);
|
|
||||||
|
|
||||||
self::assertSame('42', $violation->getCode());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of the Symfony package.
|
|
||||||
*
|
|
||||||
* (c) Fabien Potencier <fabien@symfony.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Symfony\Component\Validator\Tests\Violation;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
use Symfony\Component\Translation\IdentityTranslator;
|
|
||||||
use Symfony\Component\Validator\ConstraintViolationList;
|
|
||||||
use Symfony\Component\Validator\Tests\Fixtures\ConstraintA;
|
|
||||||
use Symfony\Component\Validator\Violation\ConstraintViolationBuilder;
|
|
||||||
|
|
||||||
class ConstraintViolationBuilderTest extends TestCase
|
|
||||||
{
|
|
||||||
public function testNonStringCode()
|
|
||||||
{
|
|
||||||
$constraintViolationList = new ConstraintViolationList();
|
|
||||||
(new ConstraintViolationBuilder($constraintViolationList, new ConstraintA(), 'invalid message', [], null, 'foo', 'baz', new IdentityTranslator()))
|
|
||||||
->setCode(42)
|
|
||||||
->addViolation();
|
|
||||||
|
|
||||||
self::assertSame('42', $constraintViolationList->get(0)->getCode());
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user