Skip to content

Commit 832f46e

Browse files
committed
Removed all $that variables
1 parent 0d2f9cb commit 832f46e

File tree

2 files changed

+22
-53
lines changed

2 files changed

+22
-53
lines changed

Tests/OptionsResolverTest.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,13 @@ public function testResolveLazyDependencyOnOptional()
9999

100100
public function testResolveLazyDependencyOnMissingOptionalWithoutDefault()
101101
{
102-
$test = $this;
103-
104102
$this->resolver->setOptional(array(
105103
'one',
106104
));
107105

108106
$this->resolver->setDefaults(array(
109-
'two' => function (Options $options) use ($test) {
110-
/* @var \PHPUnit_Framework_TestCase $test */
111-
$test->assertFalse(isset($options['one']));
107+
'two' => function (Options $options) {
108+
$this->assertFalse(isset($options['one']));
112109

113110
return '2';
114111
},
@@ -123,16 +120,13 @@ public function testResolveLazyDependencyOnMissingOptionalWithoutDefault()
123120

124121
public function testResolveLazyDependencyOnOptionalWithoutDefault()
125122
{
126-
$test = $this;
127-
128123
$this->resolver->setOptional(array(
129124
'one',
130125
));
131126

132127
$this->resolver->setDefaults(array(
133-
'two' => function (Options $options) use ($test) {
134-
/* @var \PHPUnit_Framework_TestCase $test */
135-
$test->assertTrue(isset($options['one']));
128+
'two' => function (Options $options) {
129+
$this->assertTrue(isset($options['one']));
136130

137131
return $options['one'].'2';
138132
},
@@ -171,12 +165,9 @@ public function testResolveLazyDependencyOnRequired()
171165

172166
public function testResolveLazyReplaceDefaults()
173167
{
174-
$test = $this;
175-
176168
$this->resolver->setDefaults(array(
177-
'one' => function (Options $options) use ($test) {
178-
/* @var \PHPUnit_Framework_TestCase $test */
179-
$test->fail('Previous closure should not be executed');
169+
'one' => function (Options $options) {
170+
$this->fail('Previous closure should not be executed');
180171
},
181172
));
182173

Tests/OptionsTest.php

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ protected function setUp()
3131

3232
public function testSetLazyOption()
3333
{
34-
$test = $this;
35-
36-
$this->options->set('foo', function (Options $options) use ($test) {
34+
$this->options->set('foo', function (Options $options) {
3735
return 'dynamic';
3836
});
3937

@@ -42,15 +40,12 @@ public function testSetLazyOption()
4240

4341
public function testOverloadKeepsPreviousValue()
4442
{
45-
$test = $this;
46-
4743
// defined by superclass
4844
$this->options->set('foo', 'bar');
4945

5046
// defined by subclass
51-
$this->options->overload('foo', function (Options $options, $previousValue) use ($test) {
52-
/* @var \PHPUnit_Framework_TestCase $test */
53-
$test->assertEquals('bar', $previousValue);
47+
$this->options->overload('foo', function (Options $options, $previousValue) {
48+
$this->assertEquals('bar', $previousValue);
5449

5550
return 'dynamic';
5651
});
@@ -60,17 +55,14 @@ public function testOverloadKeepsPreviousValue()
6055

6156
public function testPreviousValueIsEvaluatedIfLazy()
6257
{
63-
$test = $this;
64-
6558
// defined by superclass
6659
$this->options->set('foo', function (Options $options) {
6760
return 'bar';
6861
});
6962

7063
// defined by subclass
71-
$this->options->overload('foo', function (Options $options, $previousValue) use ($test) {
72-
/* @var \PHPUnit_Framework_TestCase $test */
73-
$test->assertEquals('bar', $previousValue);
64+
$this->options->overload('foo', function (Options $options, $previousValue) {
65+
$this->assertEquals('bar', $previousValue);
7466

7567
return 'dynamic';
7668
});
@@ -80,15 +72,13 @@ public function testPreviousValueIsEvaluatedIfLazy()
8072

8173
public function testPreviousValueIsNotEvaluatedIfNoSecondArgument()
8274
{
83-
$test = $this;
84-
8575
// defined by superclass
86-
$this->options->set('foo', function (Options $options) use ($test) {
87-
$test->fail('Should not be called');
76+
$this->options->set('foo', function (Options $options) {
77+
$this->fail('Should not be called');
8878
});
8979

9080
// defined by subclass, no $previousValue argument defined!
91-
$this->options->overload('foo', function (Options $options) use ($test) {
81+
$this->options->overload('foo', function (Options $options) {
9282
return 'dynamic';
9383
});
9484

@@ -97,13 +87,10 @@ public function testPreviousValueIsNotEvaluatedIfNoSecondArgument()
9787

9888
public function testLazyOptionCanAccessOtherOptions()
9989
{
100-
$test = $this;
101-
10290
$this->options->set('foo', 'bar');
10391

104-
$this->options->set('bam', function (Options $options) use ($test) {
105-
/* @var \PHPUnit_Framework_TestCase $test */
106-
$test->assertEquals('bar', $options->get('foo'));
92+
$this->options->set('bam', function (Options $options) {
93+
$this->assertEquals('bar', $options->get('foo'));
10794

10895
return 'dynamic';
10996
});
@@ -113,15 +100,12 @@ public function testLazyOptionCanAccessOtherOptions()
113100

114101
public function testLazyOptionCanAccessOtherLazyOptions()
115102
{
116-
$test = $this;
117-
118103
$this->options->set('foo', function (Options $options) {
119104
return 'bar';
120105
});
121106

122-
$this->options->set('bam', function (Options $options) use ($test) {
123-
/* @var \PHPUnit_Framework_TestCase $test */
124-
$test->assertEquals('bar', $options->get('foo'));
107+
$this->options->set('bam', function (Options $options) {
108+
$this->assertEquals('bar', $options->get('foo'));
125109

126110
return 'dynamic';
127111
});
@@ -153,14 +137,11 @@ public function testNormalizerReceivesUnnormalizedValue()
153137

154138
public function testNormalizerCanAccessOtherOptions()
155139
{
156-
$test = $this;
157-
158140
$this->options->set('foo', 'bar');
159141
$this->options->set('bam', 'baz');
160142

161-
$this->options->setNormalizer('bam', function (Options $options) use ($test) {
162-
/* @var \PHPUnit_Framework_TestCase $test */
163-
$test->assertEquals('bar', $options->get('foo'));
143+
$this->options->setNormalizer('bam', function (Options $options) {
144+
$this->assertEquals('bar', $options->get('foo'));
164145

165146
return 'normalized';
166147
});
@@ -170,16 +151,13 @@ public function testNormalizerCanAccessOtherOptions()
170151

171152
public function testNormalizerCanAccessOtherLazyOptions()
172153
{
173-
$test = $this;
174-
175154
$this->options->set('foo', function (Options $options) {
176155
return 'bar';
177156
});
178157
$this->options->set('bam', 'baz');
179158

180-
$this->options->setNormalizer('bam', function (Options $options) use ($test) {
181-
/* @var \PHPUnit_Framework_TestCase $test */
182-
$test->assertEquals('bar', $options->get('foo'));
159+
$this->options->setNormalizer('bam', function (Options $options) {
160+
$this->assertEquals('bar', $options->get('foo'));
183161

184162
return 'normalized';
185163
});

0 commit comments

Comments
 (0)