Skip to content

Commit 1be53af

Browse files
authored
Merge pull request #28 from MacPaw/feat/orc-154-upgrade-doctrine-orm-3-version
feat(o10r-symfony-template-154): Upgrade doctrine/orm to 3.* version …
2 parents b485886 + 0459edb commit 1be53af

File tree

7 files changed

+26
-31
lines changed

7 files changed

+26
-31
lines changed

.github/workflows/ci.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
doctrine-orm-versions:
2626
- '^2.17'
2727
- '^3.0'
28+
doctrine-dbal-versions:
29+
- '^3.0'
2830
exclude:
2931
- php: '8.1'
3032
symfony-versions: '7.0.*'
@@ -36,8 +38,15 @@ jobs:
3638
coverage: 'xdebug'
3739
doctrine-orm-versions: '^3.0'
3840
symfony-versions: '^7.0'
41+
doctrine-dbal-versions: '^3.0'
42+
- description: 'Doctrine dbal 4.0 test'
43+
php: '8.2'
44+
doctrine-orm-versions: '^3.0'
45+
symfony-versions: '^7.0'
46+
doctrine-dbal-versions: '^4.0'
47+
coverage: 'none'
3948

40-
name: PHP ${{ matrix.php }} Symfony ${{ matrix.symfony-versions }} Doctrine ${{ matrix.doctrine-orm-versions }} ${{ matrix.description }}
49+
name: PHP ${{ matrix.php }} Symfony ${{ matrix.symfony-versions }} Doctrine ${{ matrix.doctrine-orm-versions }} Doctrine Dbal ${{ matrix.doctrine-dbal-versions }} ${{ matrix.description }}
4150
steps:
4251
- name: Checkout
4352
uses: actions/checkout@v2
@@ -73,6 +82,7 @@ jobs:
7382
composer require symfony/dependency-injection:${{ matrix.symfony-versions }} --no-update --no-scripts
7483
composer require symfony/http-kernel:${{ matrix.symfony-versions }} --no-update --no-scripts
7584
composer require doctrine/orm:${{ matrix.doctrine-orm-versions }} --no-update --no-scripts
85+
composer require doctrine/dbal:${{ matrix.doctrine-dbal-versions }} --no-update --no-scripts
7686
composer require --dev symfony/console:${{ matrix.symfony-versions }} --no-update --no-scripts
7787
composer require --dev symfony/property-access:${{ matrix.symfony-versions }} --no-update --no-scripts
7888

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"theofidry/alice-data-fixtures": "^1.0",
3737
"symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0 || ^7.0",
3838
"symfony/http-kernel": "^4.4 || ^5.4 || ^6.0 || ^7.0",
39-
"doctrine/dbal": "^2.0 || ^3.0"
39+
"doctrine/dbal": "^2.0 || ^3.0 || ^4.0"
4040
},
4141
"require-dev": {
4242
"phpstan/phpstan": "^1.2",

src/Database/DatabaseManagerFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
use BehatDoctrineFixtures\Database\Manager\ConsoleManager\SqliteConsoleManager;
99
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
1010
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
11-
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
12-
use Doctrine\DBAL\Platforms\SqlitePlatform;
11+
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
12+
use Doctrine\DBAL\Platforms\SQLitePlatform;
1313
use Doctrine\Migrations\Metadata\Storage\TableMetadataStorageConfiguration;
1414
use Doctrine\ORM\EntityManagerInterface;
1515
use Psr\Log\LoggerInterface;
@@ -43,7 +43,7 @@ public function createDatabaseManager(
4343
$databasePlatform = $entityManager->getConnection()->getDatabasePlatform();
4444
$connection = $entityManager->getConnection();
4545

46-
if ($databasePlatform instanceof SqlitePlatform) {
46+
if ($databasePlatform instanceof SQLitePlatform) {
4747
$consoleManager = new SqliteConsoleManager();
4848
return new SqliteDatabaseManager(
4949
$consoleManager,
@@ -55,7 +55,7 @@ public function createDatabaseManager(
5555
);
5656
}
5757

58-
if ($databasePlatform instanceof PostgreSQL100Platform) {
58+
if ($databasePlatform instanceof PostgreSQLPlatform) {
5959
$consoleManager = new PostgreConsoleManager($this->cacheDir, $runMigrationCommand);
6060
$purger = new ORMPurger($entityManager);
6161
$executor = new ORMExecutor($entityManager, $purger);

tests/Unit/Database/DatabaseManager/DatabaseManagerTest.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,8 @@
44

55
namespace BehatDoctrineFixtures\Tests\Unit\Database\DatabaseManager;
66

7-
use BehatDoctrineFixtures\Database\DatabaseManagerFactory;
8-
use BehatDoctrineFixtures\Database\Exception\DatabaseManagerNotFoundForCurrentPlatform;
97
use BehatDoctrineFixtures\Database\Manager\DatabaseManager;
10-
use BehatDoctrineFixtures\Database\Manager\PostgreSQLDatabaseManager;
11-
use BehatDoctrineFixtures\Database\Manager\SqliteDatabaseManager;
12-
use Doctrine\DBAL\Connection;
13-
use Doctrine\DBAL\Platforms\MySQLPlatform;
14-
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
15-
use Doctrine\DBAL\Platforms\SqlitePlatform;
16-
use Doctrine\ORM\EntityManagerInterface;
178
use PHPUnit\Framework\TestCase;
18-
use Psr\Log\LoggerInterface;
19-
use ReflectionClass;
209

2110
final class DatabaseManagerTest extends TestCase
2211
{

tests/Unit/Database/DatabaseManager/PostgreSQLDatabaseManagerTest.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88
use BehatDoctrineFixtures\Database\Manager\PostgreSQLDatabaseManager;
99
use BehatDoctrineFixtures\Tests\Unit\Database\AbstractDatabaseManagerTest;
1010
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
11-
use Doctrine\DBAL\Connection;
12-
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
11+
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
1312
use Doctrine\DBAL\Result;
14-
use PHPUnit\Framework\MockObject\MockObject;
15-
use PHPUnit\Framework\TestCase;
1613
use Psr\Log\LoggerInterface;
1714

1815
final class PostgreSQLDatabaseManagerTest extends AbstractDatabaseManagerTest
@@ -52,7 +49,7 @@ public function testSaveBackupSuccess()
5249
);
5350

5451
$connection = $this->createConnectionMockWithPlatformAndParams(
55-
PostgreSQL100Platform::class,
52+
PostgreSQLPlatform::class,
5653
[
5754
'password' => $password,
5855
'user' => $user,
@@ -119,7 +116,7 @@ public function testLoadBackupSuccess()
119116
->method('purge');
120117

121118
$connection = $this->createConnectionMockWithPlatformAndParams(
122-
PostgreSQL100Platform::class,
119+
PostgreSQLPlatform::class,
123120
[
124121
'password' => $password,
125122
'user' => $user,
@@ -181,7 +178,7 @@ public function testPrepareSchemaWithNotCreatedSchema(): void
181178
);
182179

183180
$connection = $this->createConnectionMockWithPlatformAndParams(
184-
PostgreSQL100Platform::class,
181+
PostgreSQLPlatform::class,
185182
[
186183
'password' => $password,
187184
'user' => $user,
@@ -250,7 +247,7 @@ public function testPrepareSchemaWithCreatedSchema(): void
250247
);
251248

252249
$connection = $this->createConnectionMockWithPlatformAndParams(
253-
PostgreSQL100Platform::class,
250+
PostgreSQLPlatform::class,
254251
[
255252
'password' => $password,
256253
'user' => $user,

tests/Unit/Database/DatabaseManager/SqliteDatabaseManagerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use BehatDoctrineFixtures\Database\Manager\ConsoleManager\SqliteConsoleManager;
88
use BehatDoctrineFixtures\Database\Manager\SqliteDatabaseManager;
99
use BehatDoctrineFixtures\Tests\Unit\Database\AbstractDatabaseManagerTest;
10-
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
10+
use Doctrine\DBAL\Platforms\SQLitePlatform;
1111
use Doctrine\ORM\EntityManagerInterface;
1212
use Psr\Log\LoggerInterface;
1313

@@ -31,7 +31,7 @@ public function testSaveBackupSuccess()
3131

3232
$connectionName = 'default';
3333
$connection = $this->createConnectionMockWithPlatformAndParams(
34-
PostgreSQL100Platform::class,
34+
SQLitePlatform::class,
3535
[
3636
'path' => $databasePath
3737
]
@@ -70,7 +70,7 @@ public function testLoadBackupSuccess(): void
7070

7171
$connectionName = 'default';
7272
$connection = $this->createConnectionMockWithPlatformAndParams(
73-
PostgreSQL100Platform::class,
73+
SQLitePlatform::class,
7474
[
7575
'path' => $databasePath
7676
]

tests/Unit/Database/DatabaseManagerFactoryTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
use BehatDoctrineFixtures\Database\Manager\PostgreSQLDatabaseManager;
1010
use BehatDoctrineFixtures\Database\Manager\SqliteDatabaseManager;
1111
use Doctrine\Common\EventManager;
12-
use Doctrine\DBAL\Connection;
1312
use Doctrine\DBAL\Platforms\MySQLPlatform;
14-
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
13+
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
1514
use Doctrine\DBAL\Platforms\SqlitePlatform;
1615
use Doctrine\Migrations\Metadata\Storage\TableMetadataStorageConfiguration;
1716
use Doctrine\ORM\EntityManagerInterface;
@@ -35,7 +34,7 @@ protected function setUp(): void
3534

3635
public function testCreatePostgreSQLDatabaseManagerSuccess(): void
3736
{
38-
$entityManager = $this->createEntityManagerMockWithPlatform(PostgreSQL100Platform::class);
37+
$entityManager = $this->createEntityManagerMockWithPlatform(PostgreSQLPlatform::class);
3938

4039
$eventManager = self::createMock(EventManager::class);
4140
$eventManager->expects(self::once())

0 commit comments

Comments
 (0)