11
11
12
12
namespace Symfony \Component \OptionsResolver \Tests ;
13
13
14
+ use PHPUnit \Framework \Assert ;
15
+ use PHPUnit \Framework \TestCase ;
14
16
use Symfony \Component \OptionsResolver \Exception \InvalidOptionsException ;
15
17
use Symfony \Component \OptionsResolver \Options ;
16
18
use Symfony \Component \OptionsResolver \OptionsResolver ;
17
19
18
- class OptionsResolver2Dot6Test extends \PHPUnit_Framework_TestCase
20
+ class OptionsResolver2Dot6Test extends TestCase
19
21
{
20
22
/**
21
23
* @var OptionsResolver
@@ -134,7 +136,7 @@ public function testSetLazyClosure()
134
136
public function testClosureWithoutTypeHintNotInvoked ()
135
137
{
136
138
$ closure = function ($ options ) {
137
- \PHPUnit_Framework_Assert ::fail ('Should not be called ' );
139
+ Assert ::fail ('Should not be called ' );
138
140
};
139
141
140
142
$ this ->resolver ->setDefault ('foo ' , $ closure );
@@ -145,7 +147,7 @@ public function testClosureWithoutTypeHintNotInvoked()
145
147
public function testClosureWithoutParametersNotInvoked ()
146
148
{
147
149
$ closure = function () {
148
- \PHPUnit_Framework_Assert ::fail ('Should not be called ' );
150
+ Assert ::fail ('Should not be called ' );
149
151
};
150
152
151
153
$ this ->resolver ->setDefault ('foo ' , $ closure );
@@ -160,7 +162,7 @@ public function testAccessPreviousDefaultValue()
160
162
161
163
// defined by subclass
162
164
$ this ->resolver ->setDefault ('foo ' , function (Options $ options , $ previousValue ) {
163
- \PHPUnit_Framework_Assert ::assertEquals ('bar ' , $ previousValue );
165
+ Assert ::assertEquals ('bar ' , $ previousValue );
164
166
165
167
return 'lazy ' ;
166
168
});
@@ -177,7 +179,7 @@ public function testAccessPreviousLazyDefaultValue()
177
179
178
180
// defined by subclass
179
181
$ this ->resolver ->setDefault ('foo ' , function (Options $ options , $ previousValue ) {
180
- \PHPUnit_Framework_Assert ::assertEquals ('bar ' , $ previousValue );
182
+ Assert ::assertEquals ('bar ' , $ previousValue );
181
183
182
184
return 'lazy ' ;
183
185
});
@@ -189,7 +191,7 @@ public function testPreviousValueIsNotEvaluatedIfNoSecondArgument()
189
191
{
190
192
// defined by superclass
191
193
$ this ->resolver ->setDefault ('foo ' , function () {
192
- \PHPUnit_Framework_Assert ::fail ('Should not be called ' );
194
+ Assert ::fail ('Should not be called ' );
193
195
});
194
196
195
197
// defined by subclass, no $previousValue argument defined!
@@ -203,7 +205,7 @@ public function testPreviousValueIsNotEvaluatedIfNoSecondArgument()
203
205
public function testOverwrittenLazyOptionNotEvaluated ()
204
206
{
205
207
$ this ->resolver ->setDefault ('foo ' , function (Options $ options ) {
206
- \PHPUnit_Framework_Assert ::fail ('Should not be called ' );
208
+ Assert ::fail ('Should not be called ' );
207
209
});
208
210
209
211
$ this ->resolver ->setDefault ('foo ' , 'bar ' );
@@ -216,13 +218,13 @@ public function testInvokeEachLazyOptionOnlyOnce()
216
218
$ calls = 0 ;
217
219
218
220
$ this ->resolver ->setDefault ('lazy1 ' , function (Options $ options ) use (&$ calls ) {
219
- \PHPUnit_Framework_Assert ::assertSame (1 , ++$ calls );
221
+ Assert ::assertSame (1 , ++$ calls );
220
222
221
223
$ options ['lazy2 ' ];
222
224
});
223
225
224
226
$ this ->resolver ->setDefault ('lazy2 ' , function (Options $ options ) use (&$ calls ) {
225
- \PHPUnit_Framework_Assert ::assertSame (2 , ++$ calls );
227
+ Assert ::assertSame (2 , ++$ calls );
226
228
});
227
229
228
230
$ this ->resolver ->resolve ();
@@ -996,7 +998,7 @@ public function testValidateTypeBeforeNormalization()
996
998
$ this ->resolver ->setAllowedTypes ('foo ' , 'int ' );
997
999
998
1000
$ this ->resolver ->setNormalizer ('foo ' , function () {
999
- \PHPUnit_Framework_Assert ::fail ('Should not be called. ' );
1001
+ Assert ::fail ('Should not be called. ' );
1000
1002
});
1001
1003
1002
1004
$ this ->resolver ->resolve ();
@@ -1012,7 +1014,7 @@ public function testValidateValueBeforeNormalization()
1012
1014
$ this ->resolver ->setAllowedValues ('foo ' , 'baz ' );
1013
1015
1014
1016
$ this ->resolver ->setNormalizer ('foo ' , function () {
1015
- \PHPUnit_Framework_Assert ::fail ('Should not be called. ' );
1017
+ Assert ::fail ('Should not be called. ' );
1016
1018
});
1017
1019
1018
1020
$ this ->resolver ->resolve ();
@@ -1024,8 +1026,8 @@ public function testNormalizerCanAccessOtherOptions()
1024
1026
$ this ->resolver ->setDefault ('norm ' , 'baz ' );
1025
1027
1026
1028
$ this ->resolver ->setNormalizer ('norm ' , function (Options $ options ) {
1027
- /* @var \PHPUnit_Framework_TestCase $test */
1028
- \PHPUnit_Framework_Assert ::assertSame ('bar ' , $ options ['default ' ]);
1029
+ /* @var TestCase $test */
1030
+ Assert ::assertSame ('bar ' , $ options ['default ' ]);
1029
1031
1030
1032
return 'normalized ' ;
1031
1033
});
@@ -1044,8 +1046,8 @@ public function testNormalizerCanAccessLazyOptions()
1044
1046
$ this ->resolver ->setDefault ('norm ' , 'baz ' );
1045
1047
1046
1048
$ this ->resolver ->setNormalizer ('norm ' , function (Options $ options ) {
1047
- /* @var \PHPUnit_Framework_TestCase $test */
1048
- \PHPUnit_Framework_Assert ::assertEquals ('bar ' , $ options ['lazy ' ]);
1049
+ /* @var TestCase $test */
1050
+ Assert ::assertEquals ('bar ' , $ options ['lazy ' ]);
1049
1051
1050
1052
return 'normalized ' ;
1051
1053
});
@@ -1151,12 +1153,12 @@ public function testInvokeEachNormalizerOnlyOnce()
1151
1153
$ this ->resolver ->setDefault ('norm2 ' , 'baz ' );
1152
1154
1153
1155
$ this ->resolver ->setNormalizer ('norm1 ' , function ($ options ) use (&$ calls ) {
1154
- \PHPUnit_Framework_Assert ::assertSame (1 , ++$ calls );
1156
+ Assert ::assertSame (1 , ++$ calls );
1155
1157
1156
1158
$ options ['norm2 ' ];
1157
1159
});
1158
1160
$ this ->resolver ->setNormalizer ('norm2 ' , function () use (&$ calls ) {
1159
- \PHPUnit_Framework_Assert ::assertSame (2 , ++$ calls );
1161
+ Assert ::assertSame (2 , ++$ calls );
1160
1162
});
1161
1163
1162
1164
$ this ->resolver ->resolve ();
@@ -1169,7 +1171,7 @@ public function testNormalizerNotCalledForUnsetOptions()
1169
1171
$ this ->resolver ->setDefined ('norm ' );
1170
1172
1171
1173
$ this ->resolver ->setNormalizer ('norm ' , function () {
1172
- \PHPUnit_Framework_Assert ::fail ('Should not be called. ' );
1174
+ Assert ::fail ('Should not be called. ' );
1173
1175
});
1174
1176
1175
1177
$ this ->assertEmpty ($ this ->resolver ->resolve ());
@@ -1410,17 +1412,17 @@ public function testArrayAccess()
1410
1412
});
1411
1413
1412
1414
$ this ->resolver ->setDefault ('lazy2 ' , function (Options $ options ) {
1413
- \PHPUnit_Framework_Assert ::assertTrue (isset ($ options ['default1 ' ]));
1414
- \PHPUnit_Framework_Assert ::assertTrue (isset ($ options ['default2 ' ]));
1415
- \PHPUnit_Framework_Assert ::assertTrue (isset ($ options ['required ' ]));
1416
- \PHPUnit_Framework_Assert ::assertTrue (isset ($ options ['lazy1 ' ]));
1417
- \PHPUnit_Framework_Assert ::assertTrue (isset ($ options ['lazy2 ' ]));
1418
- \PHPUnit_Framework_Assert ::assertFalse (isset ($ options ['defined ' ]));
1419
-
1420
- \PHPUnit_Framework_Assert ::assertSame (0 , $ options ['default1 ' ]);
1421
- \PHPUnit_Framework_Assert ::assertSame (42 , $ options ['default2 ' ]);
1422
- \PHPUnit_Framework_Assert ::assertSame ('value ' , $ options ['required ' ]);
1423
- \PHPUnit_Framework_Assert ::assertSame ('lazy ' , $ options ['lazy1 ' ]);
1415
+ Assert ::assertTrue (isset ($ options ['default1 ' ]));
1416
+ Assert ::assertTrue (isset ($ options ['default2 ' ]));
1417
+ Assert ::assertTrue (isset ($ options ['required ' ]));
1418
+ Assert ::assertTrue (isset ($ options ['lazy1 ' ]));
1419
+ Assert ::assertTrue (isset ($ options ['lazy2 ' ]));
1420
+ Assert ::assertFalse (isset ($ options ['defined ' ]));
1421
+
1422
+ Assert ::assertSame (0 , $ options ['default1 ' ]);
1423
+ Assert ::assertSame (42 , $ options ['default2 ' ]);
1424
+ Assert ::assertSame ('value ' , $ options ['required ' ]);
1425
+ Assert ::assertSame ('lazy ' , $ options ['lazy1 ' ]);
1424
1426
1425
1427
// Obviously $options['lazy'] and $options['defined'] cannot be
1426
1428
// accessed
@@ -1525,7 +1527,7 @@ public function testCount()
1525
1527
$ this ->resolver ->setDefault ('lazy1 ' , function () {});
1526
1528
1527
1529
$ this ->resolver ->setDefault ('lazy2 ' , function (Options $ options ) {
1528
- \PHPUnit_Framework_Assert ::assertCount (4 , $ options );
1530
+ Assert ::assertCount (4 , $ options );
1529
1531
});
1530
1532
1531
1533
$ this ->assertCount (4 , $ this ->resolver ->resolve (array ('required ' => 'value ' )));
0 commit comments