From 8b45541796ebcd933641c4f6b4d1f32e8c2b496e Mon Sep 17 00:00:00 2001 From: Tomasz Kryszan Date: Tue, 4 Apr 2023 12:22:43 +0200 Subject: [PATCH] Fixed TokenServiceTest --- src/contracts/Test/IbexaTestKernel.php | 1 + .../Core/Repository/TokenServiceTest.php | 16 +++------------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/contracts/Test/IbexaTestKernel.php b/src/contracts/Test/IbexaTestKernel.php index a7ca42770a..ece393d629 100644 --- a/src/contracts/Test/IbexaTestKernel.php +++ b/src/contracts/Test/IbexaTestKernel.php @@ -88,6 +88,7 @@ class IbexaTestKernel extends Kernel Repository\SearchService::class, Repository\SectionService::class, Repository\UserService::class, + Repository\TokenService::class, ]; /** diff --git a/tests/integration/Core/Repository/TokenServiceTest.php b/tests/integration/Core/Repository/TokenServiceTest.php index 27ff04f199..9fefb45046 100644 --- a/tests/integration/Core/Repository/TokenServiceTest.php +++ b/tests/integration/Core/Repository/TokenServiceTest.php @@ -9,12 +9,13 @@ namespace Ibexa\Tests\Integration\Core\Repository; use Ibexa\Contracts\Core\Repository\TokenService; +use Ibexa\Contracts\Core\Test\IbexaKernelTestCase; use Ibexa\Core\Base\Exceptions\TokenLengthException; /** * @covers \Ibexa\Core\Repository\TokenService */ -final class TokenServiceTest extends BaseTest +final class TokenServiceTest extends IbexaKernelTestCase { private const TOKEN_TYPE = 'foo'; private const TOKEN_TTL = 100; @@ -26,7 +27,7 @@ protected function setUp(): void { parent::setUp(); - $this->tokenService = $this->getTokenService(); + $this->tokenService = self::getServiceByClassName(TokenService::class); } /** @@ -190,15 +191,4 @@ public function provideDataForTestCheckToken(): iterable null, ]; } - - /** - * @throws \ErrorException - */ - private function getTokenService(): TokenService - { - $container = $this->getSetupFactory()->getServiceContainer(); - - /** @var \Ibexa\Contracts\Core\Repository\TokenService */ - return $container->get(TokenService::class); - } }