Skip to content

Commit

Permalink
we don't need a fake server instance outside of setUp() in these tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps committed Nov 20, 2024
1 parent d9f5634 commit d9080f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions tests/phpunit/event/AsyncEventConcurrencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
final class AsyncEventConcurrencyTest extends TestCase{

private Plugin $mockPlugin;
private Server $mockServer;

private PluginManager $pluginManager;

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

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

public static function tearDownAfterClass() : void{
Expand Down
6 changes: 2 additions & 4 deletions tests/phpunit/event/AsyncEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
use function shuffle;

final class AsyncEventTest extends TestCase{

private Server $mockServer;
private Plugin $mockPlugin;
private PluginManager $pluginManager;

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

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

public static function tearDownAfterClass() : void{
Expand Down

0 comments on commit d9080f1

Please sign in to comment.