Skip to content

Commit d9080f1

Browse files
committed
we don't need a fake server instance outside of setUp() in these tests
1 parent d9f5634 commit d9080f1

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

tests/phpunit/event/AsyncEventConcurrencyTest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
final class AsyncEventConcurrencyTest extends TestCase{
3636

3737
private Plugin $mockPlugin;
38-
private Server $mockServer;
39-
4038
private PluginManager $pluginManager;
4139

4240
//this one gets its own class because it requires a bunch of context variables
@@ -57,10 +55,10 @@ protected function setUp() : void{
5755

5856
//TODO: this is a really bad hack and could break any time if PluginManager decides to access its Server field
5957
//we really need to make it possible to register events without a Plugin or Server context
60-
$this->mockServer = $this->createMock(Server::class);
58+
$mockServer = $this->createMock(Server::class);
6159
$this->mockPlugin = self::createStub(Plugin::class);
6260
$this->mockPlugin->method('isEnabled')->willReturn(true);
63-
$this->pluginManager = new PluginManager($this->mockServer, null);
61+
$this->pluginManager = new PluginManager($mockServer, null);
6462
}
6563

6664
public static function tearDownAfterClass() : void{

tests/phpunit/event/AsyncEventTest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
use function shuffle;
3636

3737
final class AsyncEventTest extends TestCase{
38-
39-
private Server $mockServer;
4038
private Plugin $mockPlugin;
4139
private PluginManager $pluginManager;
4240

@@ -45,10 +43,10 @@ protected function setUp() : void{
4543

4644
//TODO: this is a really bad hack and could break any time if PluginManager decides to access its Server field
4745
//we really need to make it possible to register events without a Plugin or Server context
48-
$this->mockServer = $this->createMock(Server::class);
46+
$mockServer = $this->createMock(Server::class);
4947
$this->mockPlugin = self::createStub(Plugin::class);
5048
$this->mockPlugin->method('isEnabled')->willReturn(true);
51-
$this->pluginManager = new PluginManager($this->mockServer, null);
49+
$this->pluginManager = new PluginManager($mockServer, null);
5250
}
5351

5452
public static function tearDownAfterClass() : void{

0 commit comments

Comments
 (0)