@@ -86,6 +86,8 @@ public function testFailsWhenParameterHasArrayTypeHintButArgumentIsNotArray()
86
86
87
87
public function testFailsWhenResultOfExpressionIsNotAnObjectOfTheExpectedClass ()
88
88
{
89
+ $ this ->skipTestIfExpressionsAreNotAvailable ();
90
+
89
91
$ class = 'Matthias\SymfonyServiceDefinitionValidator\Tests\Fixtures\ClassWithTypeHintedConstructorArgument ' ;
90
92
91
93
$ parameter = new \ReflectionParameter (array ($ class , '__construct ' ), 'expected ' );
@@ -103,6 +105,8 @@ public function testFailsWhenResultOfExpressionIsNotAnObjectOfTheExpectedClass()
103
105
104
106
public function testFailsWhenResultOfExpressionIsNotAnObject ()
105
107
{
108
+ $ this ->skipTestIfExpressionsAreNotAvailable ();
109
+
106
110
$ class = 'Matthias\SymfonyServiceDefinitionValidator\Tests\Fixtures\ClassWithTypeHintedConstructorArgument ' ;
107
111
108
112
$ parameter = new \ReflectionParameter (array ($ class , '__construct ' ), 'expected ' );
@@ -117,6 +121,8 @@ public function testFailsWhenResultOfExpressionIsNotAnObject()
117
121
118
122
public function testFailsWhenResultOfExpressionIsNullButNullIsNotAllowed ()
119
123
{
124
+ $ this ->skipTestIfExpressionsAreNotAvailable ();
125
+
120
126
$ class = 'Matthias\SymfonyServiceDefinitionValidator\Tests\Fixtures\ClassWithTypeHintedOptionalConstructorArgument ' ;
121
127
122
128
$ parameter = new \ReflectionParameter (array ($ class , '__construct ' ), 'expected ' );
@@ -133,6 +139,8 @@ public function testFailsWhenResultOfExpressionIsNullButNullIsNotAllowed()
133
139
134
140
public function testFailsIfSyntaxOfExpressionIsInvalid ()
135
141
{
142
+ $ this ->skipTestIfExpressionsAreNotAvailable ();
143
+
136
144
$ class = 'Matthias\SymfonyServiceDefinitionValidator\Tests\Fixtures\ClassWithTypeHintedConstructorArgument ' ;
137
145
138
146
$ parameter = new \ReflectionParameter (array ($ class , '__construct ' ), 'expected ' );
@@ -147,6 +155,8 @@ public function testFailsIfSyntaxOfExpressionIsInvalid()
147
155
148
156
public function testFailsIfExpressionCouldNotBeEvaluated ()
149
157
{
158
+ $ this ->skipTestIfExpressionsAreNotAvailable ();
159
+
150
160
$ class = 'Matthias\SymfonyServiceDefinitionValidator\Tests\Fixtures\ClassWithTypeHintedConstructorArgument ' ;
151
161
152
162
$ parameter = new \ReflectionParameter (array ($ class , '__construct ' ), 'expected ' );
@@ -163,4 +173,13 @@ private function createMockResultingClassResolver()
163
173
{
164
174
return $ this ->getMock ('Matthias\SymfonyServiceDefinitionValidator\ResultingClassResolverInterface ' );
165
175
}
176
+
177
+ private function skipTestIfExpressionsAreNotAvailable ()
178
+ {
179
+ if (!class_exists ('Symfony\Component\DependencyInjection\ExpressionLanguage ' )) {
180
+ $ this ->markTestSkipped (
181
+ 'Expressions are not supported by this version of the DependencyInjection component '
182
+ );
183
+ }
184
+ }
166
185
}
0 commit comments