Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 03b91f7

Browse files
committed
fix tests
1 parent cb9c1c4 commit 03b91f7

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
use Symfony\Component\Validator\Mapping\ClassMetadata;
1818
use Symfony\Component\Validator\Mapping\Loader\AnnotationLoader;
1919

20-
/**
21-
* @requires PHP 8
22-
*/
2320
class UniqueTest extends TestCase
2421
{
22+
/**
23+
* @requires PHP 8
24+
*/
2525
public function testAttributes()
2626
{
2727
$metadata = new ClassMetadata(UniqueDummy::class);
@@ -35,6 +35,9 @@ public function testAttributes()
3535
[$cConstraint] = $metadata->properties['c']->getConstraints();
3636
self::assertSame(['my_group'], $cConstraint->groups);
3737
self::assertSame('some attached data', $cConstraint->payload);
38+
39+
[$dConstraint] = $metadata->properties['d']->getConstraints();
40+
self::assertSame(['intval'], $dConstraint->normalizer);
3841
}
3942

4043
public function testInvalidNormalizerThrowsException()
@@ -62,4 +65,7 @@ class UniqueDummy
6265

6366
#[Unique(groups: ['my_group'], payload: 'some attached data')]
6467
private $c;
68+
69+
#[Unique(normalizer: 'intval')]
70+
private $d;
6571
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@
1616
use Symfony\Component\Validator\Exception\UnexpectedValueException;
1717
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
1818

19-
class CallableClass
20-
{
21-
public static function execute(\stdClass $object)
22-
{
23-
return [$object->name, $object->email];
24-
}
25-
}
26-
2719
class UniqueValidatorTest extends ConstraintValidatorTestCase
2820
{
2921
protected function createValidator()
@@ -232,3 +224,11 @@ public function testExpectsValidCaseInsensitiveComparison()
232224
$this->assertNoViolation();
233225
}
234226
}
227+
228+
class CallableClass
229+
{
230+
public static function execute(\stdClass $object)
231+
{
232+
return [$object->name, $object->email];
233+
}
234+
}

0 commit comments

Comments
 (0)