File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 13
13
"require" : {
14
14
"php" : " >=8.0" ,
15
15
"league/tactician" : " ^1.0" ,
16
- "symfony/validator" : " ^5.1"
16
+ "symfony/validator" : " ^5.1|^6.0 "
17
17
},
18
18
"autoload" : {
19
19
"psr-4" : {
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace DMT \Test \CommandBus \Fixtures ;
4
+
5
+ use Symfony \Component \Validator \Constraints as Assert ;
6
+
7
+ class AttributeReaderCommand
8
+ {
9
+ #[Assert \NotNull()]
10
+ protected ?string $ prop = null ;
11
+
12
+ public function getProp (): ?string
13
+ {
14
+ return $ this ->prop ;
15
+ }
16
+
17
+ public function setProp ($ prop ): void
18
+ {
19
+ $ this ->prop = $ prop ;
20
+ }
21
+ }
Original file line number Diff line number Diff line change 5
5
use DMT \CommandBus \Validator \ValidationException ;
6
6
use DMT \CommandBus \Validator \ValidationMiddleware ;
7
7
use DMT \Test \CommandBus \Fixtures \AnnotationReaderCommand ;
8
+ use DMT \Test \CommandBus \Fixtures \AttributeReaderCommand ;
8
9
use DMT \Test \CommandBus \Fixtures \ClassMetadataCommand ;
9
10
use PHPUnit \Framework \Attributes \DataProvider ;
10
11
use PHPUnit \Framework \TestCase ;
@@ -59,6 +60,15 @@ public function testAnnotationReaderValidator(): void
59
60
$ middleware ->execute (new AnnotationReaderCommand (), 'gettype ' );
60
61
}
61
62
63
+ public function testAttributeReaderValidator (): void
64
+ {
65
+ $ this ->expectException (ValidationException::class);
66
+ $ this ->expectExceptionMessageMatches ("~Invalid command .* given~ " );
67
+
68
+ $ middleware = new ValidationMiddleware ();
69
+ $ middleware ->execute (new AttributeReaderCommand (), 'gettype ' );
70
+ }
71
+
62
72
#[DataProvider(methodName: "provideConstraintViolations " )]
63
73
public function testInvalidCommand (ConstraintViolationList $ violations ): void
64
74
{
You can’t perform that action at this time.
0 commit comments