From d9080f182cb02a5b058ffcb7ff6e5e21f1273403 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 20 Nov 2024 16:44:00 +0000 Subject: [PATCH] we don't need a fake server instance outside of setUp() in these tests --- tests/phpunit/event/AsyncEventConcurrencyTest.php | 6 ++---- tests/phpunit/event/AsyncEventTest.php | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/phpunit/event/AsyncEventConcurrencyTest.php b/tests/phpunit/event/AsyncEventConcurrencyTest.php index fed1edf5e7..7533ddeb75 100644 --- a/tests/phpunit/event/AsyncEventConcurrencyTest.php +++ b/tests/phpunit/event/AsyncEventConcurrencyTest.php @@ -35,8 +35,6 @@ use function count; 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 @@ -57,10 +55,10 @@ final class AsyncEventConcurrencyTest extends TestCase{ //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{ diff --git a/tests/phpunit/event/AsyncEventTest.php b/tests/phpunit/event/AsyncEventTest.php index f8d49e855a..ecc03c1930 100644 --- a/tests/phpunit/event/AsyncEventTest.php +++ b/tests/phpunit/event/AsyncEventTest.php @@ -35,8 +35,6 @@ use pocketmine\Server; use function shuffle; final class AsyncEventTest extends TestCase{ - - private Server $mockServer; private Plugin $mockPlugin; private PluginManager $pluginManager; @@ -45,10 +43,10 @@ final class AsyncEventTest extends TestCase{ //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{