Skip to content

Commit 8f81e7e

Browse files
committed
Fix tests
1 parent 269f1e2 commit 8f81e7e

File tree

5 files changed

+25
-29
lines changed

5 files changed

+25
-29
lines changed

.github/workflows/unit-tests.yml

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,20 @@ on:
99

1010
jobs:
1111
tests:
12-
runs-on: ubuntu-latest
13-
continue-on-error: ${{ matrix.can-fail }}
1412
strategy:
1513
fail-fast: false
1614
matrix:
17-
#Stable supported versions
18-
php: ['8.1', '8.2']
19-
symfony: ['5.4.*', '6.2.*']
20-
composer-flags: ['--prefer-stable']
21-
can-fail: [false]
22-
exclude:
23-
- php: '8.1'
24-
symfony: '6.2.*'
2515
include:
26-
# Lowest supported versions
27-
- php: '8.1'
28-
symfony: '5.4.*'
16+
# Lowest Deps
17+
- php: 8.1
18+
symfony: 5.4.*
2919
composer-flags: '--prefer-stable --prefer-lowest'
3020
can-fail: false
31-
# Development versions
32-
- php: '8.3'
33-
symfony: '6.3.x-dev'
34-
composer-flags: ''
35-
can-fail: true
21+
# Stable deps
22+
- php: 8.2
23+
symfony: 6.3.*
24+
composer-flags: '--prefer-stable'
25+
can-fail: false
3626

3727
name: "PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony }}${{ matrix.composer-flags != '' && format(' - Composer {0}', matrix.composer-flags) || '' }}"
3828

src/Entity/Scope.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ final class Scope implements ScopeEntityInterface
1212
use EntityTrait;
1313

1414
#[\ReturnTypeWillChange]
15-
public function jsonSerialize()
15+
public function jsonSerialize(): mixed
1616
{
1717
return $this->getIdentifier();
1818
}

tests/Acceptance/AbstractAcceptanceTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace League\Bundle\OAuth2ServerBundle\Tests\Acceptance;
66

7+
use Doctrine\DBAL\Platforms\SqlitePlatform;
78
use League\Bundle\OAuth2ServerBundle\Tests\TestHelper;
89
use Symfony\Bundle\FrameworkBundle\Console\Application;
910
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
@@ -30,7 +31,7 @@ protected function setUp(): void
3031
TestHelper::initializeDoctrineSchema($this->application);
3132

3233
$connection = $this->client->getContainer()->get('database_connection');
33-
if ('sqlite' === $connection->getDatabasePlatform()->getName()) {
34+
if ($connection->getDatabasePlatform() instanceof SqlitePlatform) {
3435
// https://www.sqlite.org/foreignkeys.html
3536
$connection->executeQuery('PRAGMA foreign_keys = ON');
3637
}

tests/Fixtures/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function getUserIdentifier(): string
3333
return FixtureFactory::FIXTURE_USER;
3434
}
3535

36-
public function eraseCredentials()
36+
public function eraseCredentials(): void
3737
{
3838
}
3939
}

tests/TestKernel.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace League\Bundle\OAuth2ServerBundle\Tests;
66

77
use Doctrine\DBAL\Platforms\SqlitePlatform;
8+
use Doctrine\ORM\Configuration as OrmConfiguration;
89
use League\Bundle\OAuth2ServerBundle\Manager\AccessTokenManagerInterface;
910
use League\Bundle\OAuth2ServerBundle\Manager\AuthorizationCodeManagerInterface;
1011
use League\Bundle\OAuth2ServerBundle\Manager\ClientManagerInterface;
@@ -20,7 +21,7 @@
2021

2122
final class TestKernel extends Kernel implements CompilerPassInterface
2223
{
23-
public function boot()
24+
public function boot(): void
2425
{
2526
$this->initializeEnvironmentVariables();
2627

@@ -47,27 +48,31 @@ public function getLogDir(): string
4748
return sprintf('%s/tests/.kernel/logs', $this->getProjectDir());
4849
}
4950

50-
public function process(ContainerBuilder $container)
51+
public function process(ContainerBuilder $container): void
5152
{
5253
$this->exposeManagerServices($container);
5354
}
5455

55-
public function registerContainerConfiguration(LoaderInterface $loader)
56+
public function registerContainerConfiguration(LoaderInterface $loader): void
5657
{
5758
$loader->load(function (ContainerBuilder $container) {
58-
$container->loadFromExtension('doctrine', [
59+
$doctrine = [
5960
'dbal' => [
60-
'driver' => 'sqlite',
61+
'driver' => 'pdo_sqlite',
6162
'charset' => 'utf8mb4',
6263
'url' => 'sqlite:///:memory:',
6364
'default_table_options' => [
6465
'charset' => 'utf8mb4',
6566
'utf8mb4_unicode_ci' => 'utf8mb4_unicode_ci',
6667
],
67-
'platform_service' => SqlitePlatform::class,
6868
],
69-
'orm' => null,
70-
]);
69+
];
70+
71+
if (method_exists(OrmConfiguration::class, 'setLazyGhostObjectEnabled')) {
72+
$doctrine['orm'] = ['enable_lazy_ghost_objects'=> true];
73+
}
74+
75+
$container->loadFromExtension('doctrine', $doctrine);
7176

7277
$container->loadFromExtension('framework', [
7378
'secret' => 'nope',

0 commit comments

Comments
 (0)