Skip to content

Commit efaa893

Browse files
committed
Add test for constraint list only
1 parent 8b56859 commit efaa893

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/Unit/ValidationRulesTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use InvalidArgumentException;
88
use PHPUnit\Framework\TestCase;
99
use Symfony\Component\Validator\Constraints\NotBlank;
10+
use Symfony\Component\Validator\Constraints\Required;
1011

1112
/**
1213
* @coversDefaultClass \DigitalRevolution\SymfonyRequestValidation\ValidationRules
@@ -24,6 +25,17 @@ public function testConstructorAndGetters(): void
2425
static::assertSame($definitions, $rules->getDefinitions());
2526
}
2627

28+
/**
29+
* @covers ::__construct
30+
* @covers ::getDefinitions
31+
*/
32+
public function testConstructorArrayOfConstraints(): void
33+
{
34+
$definitions = ['query' => [new Required(), new NotBlank()]];
35+
$rules = new ValidationRules($definitions);
36+
static::assertSame($definitions, $rules->getDefinitions());
37+
}
38+
2739
/**
2840
* @covers ::__construct
2941
*/

0 commit comments

Comments
 (0)