Skip to content

Commit 350be85

Browse files
peterrehmfabpot
authored andcommitted
Update to PHPUnit namespaces
1 parent 374a3a9 commit 350be85

File tree

3 files changed

+45
-41
lines changed

3 files changed

+45
-41
lines changed

Tests/LegacyOptionsResolverTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111

1212
namespace Symfony\Component\OptionsResolver\Tests;
1313

14+
use PHPUnit\Framework\TestCase;
1415
use Symfony\Component\OptionsResolver\OptionsResolver;
1516
use Symfony\Component\OptionsResolver\Options;
1617

1718
/**
1819
* @group legacy
1920
*/
20-
class LegacyOptionsResolverTest extends \PHPUnit_Framework_TestCase
21+
class LegacyOptionsResolverTest extends TestCase
2122
{
2223
/**
2324
* @var OptionsResolver
@@ -122,7 +123,7 @@ public function testResolveLazyDependencyOnMissingOptionalWithoutDefault()
122123

123124
$this->resolver->setDefaults(array(
124125
'two' => function (Options $options) use ($test) {
125-
/* @var \PHPUnit_Framework_TestCase $test */
126+
/* @var TestCase $test */
126127
$test->assertFalse(isset($options['one']));
127128

128129
return '2';
@@ -146,7 +147,7 @@ public function testResolveLazyDependencyOnOptionalWithoutDefault()
146147

147148
$this->resolver->setDefaults(array(
148149
'two' => function (Options $options) use ($test) {
149-
/* @var \PHPUnit_Framework_TestCase $test */
150+
/* @var TestCase $test */
150151
$test->assertTrue(isset($options['one']));
151152

152153
return $options['one'].'2';
@@ -190,7 +191,7 @@ public function testResolveLazyReplaceDefaults()
190191

191192
$this->resolver->setDefaults(array(
192193
'one' => function (Options $options) use ($test) {
193-
/* @var \PHPUnit_Framework_TestCase $test */
194+
/* @var TestCase $test */
194195
$test->fail('Previous closure should not be executed');
195196
},
196197
));

Tests/LegacyOptionsTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111

1212
namespace Symfony\Component\OptionsResolver\Tests;
1313

14+
use PHPUnit\Framework\TestCase;
1415
use Symfony\Component\OptionsResolver\Options;
1516
use Symfony\Component\OptionsResolver\OptionsResolver;
1617

1718
/**
1819
* @group legacy
1920
*/
20-
class LegacyOptionsTest extends \PHPUnit_Framework_TestCase
21+
class LegacyOptionsTest extends TestCase
2122
{
2223
/**
2324
* @var OptionsResolver
@@ -49,7 +50,7 @@ public function testOverloadKeepsPreviousValue()
4950

5051
// defined by subclass
5152
$this->options->overload('foo', function (Options $options, $previousValue) use ($test) {
52-
/* @var \PHPUnit_Framework_TestCase $test */
53+
/* @var TestCase $test */
5354
$test->assertEquals('bar', $previousValue);
5455

5556
return 'dynamic';
@@ -69,7 +70,7 @@ public function testPreviousValueIsEvaluatedIfLazy()
6970

7071
// defined by subclass
7172
$this->options->overload('foo', function (Options $options, $previousValue) use ($test) {
72-
/* @var \PHPUnit_Framework_TestCase $test */
73+
/* @var TestCase $test */
7374
$test->assertEquals('bar', $previousValue);
7475

7576
return 'dynamic';
@@ -102,7 +103,7 @@ public function testLazyOptionCanAccessOtherOptions()
102103
$this->options->set('foo', 'bar');
103104

104105
$this->options->set('bam', function (Options $options) use ($test) {
105-
/* @var \PHPUnit_Framework_TestCase $test */
106+
/* @var TestCase $test */
106107
$test->assertEquals('bar', $options->get('foo'));
107108

108109
return 'dynamic';
@@ -120,7 +121,7 @@ public function testLazyOptionCanAccessOtherLazyOptions()
120121
});
121122

122123
$this->options->set('bam', function (Options $options) use ($test) {
123-
/* @var \PHPUnit_Framework_TestCase $test */
124+
/* @var TestCase $test */
124125
$test->assertEquals('bar', $options->get('foo'));
125126

126127
return 'dynamic';
@@ -159,7 +160,7 @@ public function testNormalizerCanAccessOtherOptions()
159160
$this->options->set('bam', 'baz');
160161

161162
$this->options->setNormalizer('bam', function (Options $options) use ($test) {
162-
/* @var \PHPUnit_Framework_TestCase $test */
163+
/* @var TestCase $test */
163164
$test->assertEquals('bar', $options->get('foo'));
164165

165166
return 'normalized';
@@ -178,7 +179,7 @@ public function testNormalizerCanAccessOtherLazyOptions()
178179
$this->options->set('bam', 'baz');
179180

180181
$this->options->setNormalizer('bam', function (Options $options) use ($test) {
181-
/* @var \PHPUnit_Framework_TestCase $test */
182+
/* @var TestCase $test */
182183
$test->assertEquals('bar', $options->get('foo'));
183184

184185
return 'normalized';

Tests/OptionsResolver2Dot6Test.php

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111

1212
namespace Symfony\Component\OptionsResolver\Tests;
1313

14+
use PHPUnit\Framework\Assert;
15+
use PHPUnit\Framework\TestCase;
1416
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
1517
use Symfony\Component\OptionsResolver\Options;
1618
use Symfony\Component\OptionsResolver\OptionsResolver;
1719

18-
class OptionsResolver2Dot6Test extends \PHPUnit_Framework_TestCase
20+
class OptionsResolver2Dot6Test extends TestCase
1921
{
2022
/**
2123
* @var OptionsResolver
@@ -134,7 +136,7 @@ public function testSetLazyClosure()
134136
public function testClosureWithoutTypeHintNotInvoked()
135137
{
136138
$closure = function ($options) {
137-
\PHPUnit_Framework_Assert::fail('Should not be called');
139+
Assert::fail('Should not be called');
138140
};
139141

140142
$this->resolver->setDefault('foo', $closure);
@@ -145,7 +147,7 @@ public function testClosureWithoutTypeHintNotInvoked()
145147
public function testClosureWithoutParametersNotInvoked()
146148
{
147149
$closure = function () {
148-
\PHPUnit_Framework_Assert::fail('Should not be called');
150+
Assert::fail('Should not be called');
149151
};
150152

151153
$this->resolver->setDefault('foo', $closure);
@@ -160,7 +162,7 @@ public function testAccessPreviousDefaultValue()
160162

161163
// defined by subclass
162164
$this->resolver->setDefault('foo', function (Options $options, $previousValue) {
163-
\PHPUnit_Framework_Assert::assertEquals('bar', $previousValue);
165+
Assert::assertEquals('bar', $previousValue);
164166

165167
return 'lazy';
166168
});
@@ -177,7 +179,7 @@ public function testAccessPreviousLazyDefaultValue()
177179

178180
// defined by subclass
179181
$this->resolver->setDefault('foo', function (Options $options, $previousValue) {
180-
\PHPUnit_Framework_Assert::assertEquals('bar', $previousValue);
182+
Assert::assertEquals('bar', $previousValue);
181183

182184
return 'lazy';
183185
});
@@ -189,7 +191,7 @@ public function testPreviousValueIsNotEvaluatedIfNoSecondArgument()
189191
{
190192
// defined by superclass
191193
$this->resolver->setDefault('foo', function () {
192-
\PHPUnit_Framework_Assert::fail('Should not be called');
194+
Assert::fail('Should not be called');
193195
});
194196

195197
// defined by subclass, no $previousValue argument defined!
@@ -203,7 +205,7 @@ public function testPreviousValueIsNotEvaluatedIfNoSecondArgument()
203205
public function testOverwrittenLazyOptionNotEvaluated()
204206
{
205207
$this->resolver->setDefault('foo', function (Options $options) {
206-
\PHPUnit_Framework_Assert::fail('Should not be called');
208+
Assert::fail('Should not be called');
207209
});
208210

209211
$this->resolver->setDefault('foo', 'bar');
@@ -216,13 +218,13 @@ public function testInvokeEachLazyOptionOnlyOnce()
216218
$calls = 0;
217219

218220
$this->resolver->setDefault('lazy1', function (Options $options) use (&$calls) {
219-
\PHPUnit_Framework_Assert::assertSame(1, ++$calls);
221+
Assert::assertSame(1, ++$calls);
220222

221223
$options['lazy2'];
222224
});
223225

224226
$this->resolver->setDefault('lazy2', function (Options $options) use (&$calls) {
225-
\PHPUnit_Framework_Assert::assertSame(2, ++$calls);
227+
Assert::assertSame(2, ++$calls);
226228
});
227229

228230
$this->resolver->resolve();
@@ -996,7 +998,7 @@ public function testValidateTypeBeforeNormalization()
996998
$this->resolver->setAllowedTypes('foo', 'int');
997999

9981000
$this->resolver->setNormalizer('foo', function () {
999-
\PHPUnit_Framework_Assert::fail('Should not be called.');
1001+
Assert::fail('Should not be called.');
10001002
});
10011003

10021004
$this->resolver->resolve();
@@ -1012,7 +1014,7 @@ public function testValidateValueBeforeNormalization()
10121014
$this->resolver->setAllowedValues('foo', 'baz');
10131015

10141016
$this->resolver->setNormalizer('foo', function () {
1015-
\PHPUnit_Framework_Assert::fail('Should not be called.');
1017+
Assert::fail('Should not be called.');
10161018
});
10171019

10181020
$this->resolver->resolve();
@@ -1024,8 +1026,8 @@ public function testNormalizerCanAccessOtherOptions()
10241026
$this->resolver->setDefault('norm', 'baz');
10251027

10261028
$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']);
10291031

10301032
return 'normalized';
10311033
});
@@ -1044,8 +1046,8 @@ public function testNormalizerCanAccessLazyOptions()
10441046
$this->resolver->setDefault('norm', 'baz');
10451047

10461048
$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']);
10491051

10501052
return 'normalized';
10511053
});
@@ -1151,12 +1153,12 @@ public function testInvokeEachNormalizerOnlyOnce()
11511153
$this->resolver->setDefault('norm2', 'baz');
11521154

11531155
$this->resolver->setNormalizer('norm1', function ($options) use (&$calls) {
1154-
\PHPUnit_Framework_Assert::assertSame(1, ++$calls);
1156+
Assert::assertSame(1, ++$calls);
11551157

11561158
$options['norm2'];
11571159
});
11581160
$this->resolver->setNormalizer('norm2', function () use (&$calls) {
1159-
\PHPUnit_Framework_Assert::assertSame(2, ++$calls);
1161+
Assert::assertSame(2, ++$calls);
11601162
});
11611163

11621164
$this->resolver->resolve();
@@ -1169,7 +1171,7 @@ public function testNormalizerNotCalledForUnsetOptions()
11691171
$this->resolver->setDefined('norm');
11701172

11711173
$this->resolver->setNormalizer('norm', function () {
1172-
\PHPUnit_Framework_Assert::fail('Should not be called.');
1174+
Assert::fail('Should not be called.');
11731175
});
11741176

11751177
$this->assertEmpty($this->resolver->resolve());
@@ -1410,17 +1412,17 @@ public function testArrayAccess()
14101412
});
14111413

14121414
$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']);
14241426

14251427
// Obviously $options['lazy'] and $options['defined'] cannot be
14261428
// accessed
@@ -1525,7 +1527,7 @@ public function testCount()
15251527
$this->resolver->setDefault('lazy1', function () {});
15261528

15271529
$this->resolver->setDefault('lazy2', function (Options $options) {
1528-
\PHPUnit_Framework_Assert::assertCount(4, $options);
1530+
Assert::assertCount(4, $options);
15291531
});
15301532

15311533
$this->assertCount(4, $this->resolver->resolve(array('required' => 'value')));

0 commit comments

Comments
 (0)