15
15
use Symfony \Component \Console \Tester \CommandTester ;
16
16
use Symfony \Component \Validator \Command \DebugCommand ;
17
17
use Symfony \Component \Validator \Constraints \Email ;
18
+ use Symfony \Component \Validator \Constraints \Expression ;
18
19
use Symfony \Component \Validator \Constraints \NotBlank ;
19
20
use Symfony \Component \Validator \Mapping \ClassMetadataInterface ;
20
21
use Symfony \Component \Validator \Mapping \Factory \MetadataFactoryInterface ;
@@ -38,6 +39,11 @@ public function testOutputWithClassArgument()
38
39
->with (DummyClassOne::class)
39
40
->willReturn ($ classMetadata );
40
41
42
+ $ classMetadata
43
+ ->expects ($ this ->once ())
44
+ ->method ('getConstraints ' )
45
+ ->willReturn ([new Expression ('1 + 1 = 2 ' )]);
46
+
41
47
$ classMetadata
42
48
->expects ($ this ->once ())
43
49
->method ('getConstrainedProperties ' )
@@ -68,22 +74,28 @@ public function testOutputWithClassArgument()
68
74
Symfony\Component\Validator\Tests\Dummy\DummyClassOne
69
75
-----------------------------------------------------
70
76
71
- +---------------+--------------------------------------------------+---------+------------------------------------------------------------+
72
- |
A3E2
Property | Name | Groups | Options |
73
- +---------------+--------------------------------------------------+---------+------------------------------------------------------------+
74
- | firstArgument | Symfony\Component\Validator\Constraints\NotBlank | Default | [ |
75
- | | | | "allowNull" => false, |
76
- | | | | "message" => "This value should not be blank.", |
77
- | | | | "normalizer" => null, |
78
- | | | | "payload" => null |
79
- | | | | ] |
80
- | firstArgument | Symfony\Component\Validator\Constraints\Email | Default | [ |
81
- | | | | "message" => "This value is not a valid email address.", |
82
- | | | | "mode" => null, |
83
- | | | | "normalizer" => null, |
84
- | | | | "payload" => null |
85
- | | | | ] |
86
- +---------------+--------------------------------------------------+---------+------------------------------------------------------------+
77
+ +---------------+----------------------------------------------------+---------+------------------------------------------------------------+
78
+ | Property | Name | Groups | Options |
79
+ +---------------+----------------------------------------------------+---------+------------------------------------------------------------+
80
+ | - | Symfony\Component\Validator\Constraints\Expression | Default | [ |
81
+ | | | | "expression" => "1 + 1 = 2", |
82
+ | | | | "message" => "This value is not valid.", |
83
+ | | | | "payload" => null, |
84
+ | | | | "values" => [] |
85
+ | | | | ] |
86
+ | firstArgument | Symfony\Component\Validator\Constraints\NotBlank | Default | [ |
87
+ | | | | "allowNull" => false, |
88
+ | | | | "message" => "This value should not be blank.", |
89
+ | | | | "normalizer" => null, |
90
+ | | | | "payload" => null |
91
+ | | | | ] |
92
+ | firstArgument | Symfony\Component\Validator\Constraints\Email | Default | [ |
93
+ | | | | "message" => "This value is not a valid email address.", |
94
+ | | | | "mode" => null, |
95
+ | | | | "normalizer" => null, |
96
+ | | | | "payload" => null |
97
+ | | | | ] |
98
+ +---------------+----------------------------------------------------+---------+------------------------------------------------------------+
87
99
88
100
TXT
89
101
, $ tester ->getDisplay (true )
@@ -108,6 +120,11 @@ public function testOutputWithPathArgument()
108
120
'firstArgument ' ,
109
121
]);
110
122
123
+ $ classMetadata
124
+ ->expects ($ this ->exactly (2 ))
125
+ ->method ('getConstraints ' )
126
+ ->willReturn ([new Expression ('1 + 1 = 2 ' )]);
127
+
111
128
$ classMetadata
112
129
->method ('getPropertyMetadata ' )
113
130
->with ('firstArgument ' )
@@ -129,42 +146,54 @@ public function testOutputWithPathArgument()
129
146
Symfony\Component\Validator\Tests\Dummy\DummyClassOne
130
147
-----------------------------------------------------
131
148
132
- +---------------+--------------------------------------------------+---------+------------------------------------------------------------+
133
- | Property | Name | Groups | Options |
134
- +---------------+--------------------------------------------------+---------+------------------------------------------------------------+
135
- | firstArgument | Symfony\Component\Validator\Constraints\NotBlank | Default | [ |
136
- | | | | "allowNull" => false, |
137
- | | | | "message" => "This value should not be blank.", |
138
- | | | | "normalizer" => null, |
139
- | | | | "payload" => null |
140
- | | | | ] |
141
- | firstArgument | Symfony\Component\Validator\Constraints\Email | Default | [ |
142
- | | | | "message" => "This value is not a valid email address.", |
143
- | | | | "mode" => null, |
144
- | | | | "normalizer" => null, |
145
- | | | | "payload" => null |
146
- | | | | ] |
147
- +---------------+--------------------------------------------------+---------+------------------------------------------------------------+
149
+ +---------------+----------------------------------------------------+---------+------------------------------------------------------------+
150
+ | Property | Name | Groups | Options |
151
+ +---------------+----------------------------------------------------+---------+------------------------------------------------------------+
152
+ | - | Symfony\Component\Validator\Constraints\Expression | Default | [ |
153
+ | | | | "expression" => "1 + 1 = 2", |
154
+ | | | | "message" => "This value is not valid.", |
155
+ | | | | "payload" => null, |
156
+ | | | | "values" => [] |
157
+ | | | | ] |
158
+ | firstArgument | Symfony\Component\Validator\Constraints\NotBlank | Default | [ |
159
+ | | | | "allowNull" => false, |
160
+ | | | | "message" => "This value should not be blank.", |
161
+ | | | | "normalizer" => null, |
162
+ | | | | "payload" => null |
163
+ | | | | ] |
164
+ | firstArgument | Symfony\Component\Validator\Constraints\Email | Default | [ |
165
+ | | | | "message" => "This value is not a valid email address.", |
166
+ | | | | "mode" => null, |
167
+ | | | | "normalizer" => null, |
168
+ | | | | "payload" => null |
169
+ | | | | ] |
170
+ +---------------+----------------------------------------------------+---------+------------------------------------------------------------+
148
171
149
172
Symfony\Component\Validator\Tests\Dummy\DummyClassTwo
150
173
-----------------------------------------------------
151
174
152
- +---------------+--------------------------------------------------+---------+------------------------------------------------------------+
153
- | Property | Name | Groups | Options |
154
- +---------------+--------------------------------------------------+---------+------------------------------------------------------------+
155
- | firstArgument | Symfony\Component\Validator\Constraints\NotBlank | Default | [ |
156
- | | | | "allowNull" => false, |
157
- | | | | "message" => "This value should not be blank.", |
158
- | | | | "normalizer" => null, |
159
- | | | | "payload" => null |
160
- | | | | ] |
161
- | firstArgument | Symfony\Component\Validator\Constraints\Email | Default | [ |
162
- | | | | "message" => "This value is not a valid email address.", |
163
- | | | | "mode" => null, |
164
- | | | | "normalizer" => null, |
165
- | | | | "payload" => null |
166
- | | | | ] |
167
- +---------------+--------------------------------------------------+---------+------------------------------------------------------------+
175
+ +---------------+----------------------------------------------------+---------+------------------------------------------------------------+
176
+ | Property | Name | Groups | Options |
177
+ +---------------+----------------------------------------------------+---------+------------------------------------------------------------+
178
+ | - | Symfony\Component\Validator\Constraints\Expression | Default | [ |
179
+ | | | | "expression" => "1 + 1 = 2", |
180
+ | | | | "message" => "This value is not valid.", |
181
+ | | | | "payload" => null, |
182
+ | | | | "values" => [] |
183
+ | | | | ] |
184
+ | firstArgument | Symfony\Component\Validator\Constraints\NotBlank | Default | [ |
185
+ | | | | "allowNull" => false, |
186
+ | | | | "message" => "This value should not be blank.", |
187
+ | | | | "normalizer" => null, |
188
+ | | | | "payload" => null |
189
+ | | | | ] |
190
+ | firstArgument | Symfony\Component\Validator\Constraints\Email | Default | [ |
191
+ | | | | "message" => "This value is not a valid email address.", |
192
+ | | | | "mode" => null, |
193
+ | | | | "normalizer" => null, |
194
+ | | | | "payload" => null |
195
+ | | | | ] |
196
+ +---------------+----------------------------------------------------+---------+------------------------------------------------------------+
168
197
169
198
TXT
170
199
, $ tester ->getDisplay (true )
0 commit comments