diff --git a/src/Entity/Scope.php b/src/Entity/Scope.php index 08a9c168..ad61965f 100644 --- a/src/Entity/Scope.php +++ b/src/Entity/Scope.php @@ -12,7 +12,7 @@ final class Scope implements ScopeEntityInterface use EntityTrait; #[\ReturnTypeWillChange] - public function jsonSerialize() + public function jsonSerialize(): mixed { return $this->getIdentifier(); } diff --git a/tests/Acceptance/AbstractAcceptanceTest.php b/tests/Acceptance/AbstractAcceptanceTest.php index 18624c28..23509d50 100644 --- a/tests/Acceptance/AbstractAcceptanceTest.php +++ b/tests/Acceptance/AbstractAcceptanceTest.php @@ -4,6 +4,7 @@ namespace League\Bundle\OAuth2ServerBundle\Tests\Acceptance; +use Doctrine\DBAL\Platforms\SqlitePlatform; use League\Bundle\OAuth2ServerBundle\Tests\TestHelper; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Bundle\FrameworkBundle\KernelBrowser; @@ -30,7 +31,7 @@ protected function setUp(): void TestHelper::initializeDoctrineSchema($this->application); $connection = $this->client->getContainer()->get('database_connection'); - if ('sqlite' === $connection->getDatabasePlatform()->getName()) { + if ($connection->getDatabasePlatform() instanceof SqlitePlatform) { // https://www.sqlite.org/foreignkeys.html $connection->executeQuery('PRAGMA foreign_keys = ON'); } diff --git a/tests/Fixtures/User.php b/tests/Fixtures/User.php index 43702bf7..277db961 100644 --- a/tests/Fixtures/User.php +++ b/tests/Fixtures/User.php @@ -33,7 +33,7 @@ public function getUserIdentifier(): string return FixtureFactory::FIXTURE_USER; } - public function eraseCredentials() + public function eraseCredentials(): void { } } diff --git a/tests/TestKernel.php b/tests/TestKernel.php index 12abdec2..acfc1a2a 100644 --- a/tests/TestKernel.php +++ b/tests/TestKernel.php @@ -5,6 +5,7 @@ namespace League\Bundle\OAuth2ServerBundle\Tests; use Doctrine\DBAL\Platforms\SqlitePlatform; +use Doctrine\ORM\Configuration as OrmConfiguration; use League\Bundle\OAuth2ServerBundle\Manager\AccessTokenManagerInterface; use League\Bundle\OAuth2ServerBundle\Manager\AuthorizationCodeManagerInterface; use League\Bundle\OAuth2ServerBundle\Manager\ClientManagerInterface; @@ -20,7 +21,7 @@ final class TestKernel extends Kernel implements CompilerPassInterface { - public function boot() + public function boot(): void { $this->initializeEnvironmentVariables(); @@ -47,27 +48,31 @@ public function getLogDir(): string return sprintf('%s/tests/.kernel/logs', $this->getProjectDir()); } - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $this->exposeManagerServices($container); } - public function registerContainerConfiguration(LoaderInterface $loader) + public function registerContainerConfiguration(LoaderInterface $loader): void { $loader->load(function (ContainerBuilder $container) { - $container->loadFromExtension('doctrine', [ + $doctrine = [ 'dbal' => [ - 'driver' => 'sqlite', + 'driver' => 'pdo_sqlite', 'charset' => 'utf8mb4', 'url' => 'sqlite:///:memory:', 'default_table_options' => [ 'charset' => 'utf8mb4', 'utf8mb4_unicode_ci' => 'utf8mb4_unicode_ci', ], - 'platform_service' => SqlitePlatform::class, ], - 'orm' => null, - ]); + ]; + + if (method_exists(OrmConfiguration::class, 'setLazyGhostObjectEnabled')) { + $doctrine['orm'] = ['enable_lazy_ghost_objects'=> true]; + } + + $container->loadFromExtension('doctrine', $doctrine); $container->loadFromExtension('framework', [ 'secret' => 'nope',