Skip to content

Commit a64526c

Browse files
author
Lucas Michot
authored
No need to call unset many times. (#36663)
1 parent 9522b1f commit a64526c

File tree

7 files changed

+14
-23
lines changed

7 files changed

+14
-23
lines changed

tests/Auth/AuthAccessGateTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,12 @@ public function testBeforeAndAfterCallbacksCanAllowGuests()
184184
$this->assertTrue($_SERVER['__laravel.gateAfter']);
185185
$this->assertFalse($_SERVER['__laravel.gateAfter2']);
186186

187-
unset($_SERVER['__laravel.gateBefore']);
188-
unset($_SERVER['__laravel.gateBefore2']);
189-
unset($_SERVER['__laravel.gateAfter']);
190-
unset($_SERVER['__laravel.gateAfter2']);
187+
unset(
188+
$_SERVER['__laravel.gateBefore'],
189+
$_SERVER['__laravel.gateBefore2'],
190+
$_SERVER['__laravel.gateAfter'],
191+
$_SERVER['__laravel.gateAfter2']
192+
);
191193
}
192194

193195
public function testResourceGatesCanBeDefined()

tests/Bus/BusBatchTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,7 @@ public function createSchema()
7070
*/
7171
protected function tearDown(): void
7272
{
73-
unset($_SERVER['__finally.batch']);
74-
unset($_SERVER['__then.batch']);
75-
unset($_SERVER['__catch.batch']);
76-
unset($_SERVER['__catch.exception']);
73+
unset($_SERVER['__finally.batch'], $_SERVER['__then.batch'], $_SERVER['__catch.batch'], $_SERVER['__catch.exception']);
7774

7875
$this->schema()->drop('job_batches');
7976

tests/Database/DatabaseEloquentFactoryTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,7 @@ public function test_after_creating_and_making_callbacks_are_called()
200200
$this->assertSame($user, $_SERVER['__test.user.making']);
201201
$this->assertSame($user, $_SERVER['__test.user.creating']);
202202

203-
unset($_SERVER['__test.user.making']);
204-
unset($_SERVER['__test.user.creating']);
203+
unset($_SERVER['__test.user.making'], $_SERVER['__test.user.creating']);
205204
}
206205

207206
public function test_has_many_relationship()
@@ -232,9 +231,7 @@ public function test_has_many_relationship()
232231
$this->assertInstanceOf(Eloquent::class, $_SERVER['__test.post.creating-user']);
233232
$this->assertInstanceOf(Eloquent::class, $_SERVER['__test.post.state-user']);
234233

235-
unset($_SERVER['__test.post.creating-post']);
236-
unset($_SERVER['__test.post.creating-user']);
237-
unset($_SERVER['__test.post.state-user']);
234+
unset($_SERVER['__test.post.creating-post'], $_SERVER['__test.post.creating-user'], $_SERVER['__test.post.state-user']);
238235
}
239236

240237
public function test_belongs_to_relationship()
@@ -331,8 +328,7 @@ public function test_belongs_to_many_relationship()
331328
$this->assertInstanceOf(Eloquent::class, $_SERVER['__test.role.creating-role']);
332329
$this->assertInstanceOf(Eloquent::class, $_SERVER['__test.role.creating-user']);
333330

334-
unset($_SERVER['__test.role.creating-role']);
335-
unset($_SERVER['__test.role.creating-user']);
331+
unset($_SERVER['__test.role.creating-role'], $_SERVER['__test.role.creating-user']);
336332
}
337333

338334
public function test_belongs_to_many_relationship_with_existing_model_instances()

tests/Events/EventsDispatcherTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,7 @@ public function testBothClassesAndInterfacesWork()
388388
$this->assertSame('fooo', $_SERVER['__event.test1']);
389389
$this->assertSame('baar', $_SERVER['__event.test2']);
390390

391-
unset($_SERVER['__event.test1']);
392-
unset($_SERVER['__event.test2']);
391+
unset($_SERVER['__event.test1'], $_SERVER['__event.test2']);
393392
}
394393

395394
public function testNestedEvent()

tests/Foundation/Bootstrap/LoadEnvironmentVariablesTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ class LoadEnvironmentVariablesTest extends TestCase
1111
{
1212
protected function tearDown(): void
1313
{
14-
unset($_ENV['FOO']);
15-
unset($_SERVER['FOO']);
14+
unset($_ENV['FOO'], $_SERVER['FOO']);
1615
putenv('FOO');
1716
m::close();
1817
}

tests/Integration/Routing/CompiledRouteCollectionTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ protected function tearDown(): void
3939
{
4040
parent::tearDown();
4141

42-
unset($this->routeCollection);
43-
unset($this->router);
42+
unset($this->routeCollection, $this->router);
4443
}
4544

4645
/**

tests/Pipeline/PipelineTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ public function testPipelineBasicUsage()
2828
$this->assertSame('foo', $_SERVER['__test.pipe.one']);
2929
$this->assertSame('foo', $_SERVER['__test.pipe.two']);
3030

31-
unset($_SERVER['__test.pipe.one']);
32-
unset($_SERVER['__test.pipe.two']);
31+
unset($_SERVER['__test.pipe.one'], $_SERVER['__test.pipe.two']);
3332
}
3433

3534
public function testPipelineUsageWithObjects()

0 commit comments

Comments
 (0)