From ba62a548bfc7b80a42375b5d95968e9c7adbfe2d Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 6 Nov 2024 05:59:12 +0700 Subject: [PATCH] refactor: Move property to local variable on usage only in setUp() method in tests --- .../Authenticators/SessionAuthenticatorTest.php | 6 ++---- tests/Authentication/Filters/JWTFilterTest.php | 2 -- tests/Authentication/MagicLinkTest.php | 1 - tests/Authorization/AuthorizableTest.php | 1 - tests/Controllers/LoginTest.php | 2 -- tests/Controllers/RegisterTest.php | 2 -- 6 files changed, 2 insertions(+), 12 deletions(-) diff --git a/tests/Authentication/Authenticators/SessionAuthenticatorTest.php b/tests/Authentication/Authenticators/SessionAuthenticatorTest.php index 3fb04a386..f33c543d2 100644 --- a/tests/Authentication/Authenticators/SessionAuthenticatorTest.php +++ b/tests/Authentication/Authenticators/SessionAuthenticatorTest.php @@ -36,8 +36,6 @@ final class SessionAuthenticatorTest extends DatabaseTestCase use FakeUser; private Session $auth; - protected $namespace; - private MockEvents $events; protected function setUp(): void { @@ -51,8 +49,8 @@ protected function setUp(): void $authenticator = $auth->factory('session'); $this->auth = $authenticator; - $this->events = new MockEvents(); - Services::injectMock('events', $this->events); + $events = new MockEvents(); + Services::injectMock('events', $events); $this->db->table($this->tables['identities'])->truncate(); } diff --git a/tests/Authentication/Filters/JWTFilterTest.php b/tests/Authentication/Filters/JWTFilterTest.php index f26ef13fa..5502fe759 100644 --- a/tests/Authentication/Filters/JWTFilterTest.php +++ b/tests/Authentication/Filters/JWTFilterTest.php @@ -31,8 +31,6 @@ final class JWTFilterTest extends DatabaseTestCase { use FeatureTestTrait; - protected $namespace; - protected function setUp(): void { Services::reset(true); diff --git a/tests/Authentication/MagicLinkTest.php b/tests/Authentication/MagicLinkTest.php index 382f5ba90..19e5c52f8 100644 --- a/tests/Authentication/MagicLinkTest.php +++ b/tests/Authentication/MagicLinkTest.php @@ -30,7 +30,6 @@ final class MagicLinkTest extends DatabaseTestCase use FeatureTestTrait; protected $refresh = true; - protected $namespace; protected function setUp(): void { diff --git a/tests/Authorization/AuthorizableTest.php b/tests/Authorization/AuthorizableTest.php index 5f3d9ff9c..0728a02cf 100644 --- a/tests/Authorization/AuthorizableTest.php +++ b/tests/Authorization/AuthorizableTest.php @@ -29,7 +29,6 @@ final class AuthorizableTest extends DatabaseTestCase use FakeUser; protected $refresh = true; - protected $namespace; protected function setUp(): void { diff --git a/tests/Controllers/LoginTest.php b/tests/Controllers/LoginTest.php index c0b6ba8bb..95716dc24 100644 --- a/tests/Controllers/LoginTest.php +++ b/tests/Controllers/LoginTest.php @@ -31,8 +31,6 @@ final class LoginTest extends DatabaseTestCase use FeatureTestTrait; use FakeUser; - protected $namespace; - protected function setUp(): void { parent::setUp(); diff --git a/tests/Controllers/RegisterTest.php b/tests/Controllers/RegisterTest.php index 03a6587f9..e01b726e3 100644 --- a/tests/Controllers/RegisterTest.php +++ b/tests/Controllers/RegisterTest.php @@ -33,8 +33,6 @@ final class RegisterTest extends DatabaseTestCase use FeatureTestTrait; use FakeUser; - protected $namespace; - protected function setUp(): void { Services::reset(true);