Skip to content

Commit

Permalink
Merge pull request #28 from MacPaw/feat/orc-154-upgrade-doctrine-orm-…
Browse files Browse the repository at this point in the history
…3-version

feat(o10r-symfony-template-154): Upgrade doctrine/orm to 3.* version …
  • Loading branch information
Yozhef authored Oct 12, 2024
2 parents b485886 + 0459edb commit 1be53af
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 31 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
doctrine-orm-versions:
- '^2.17'
- '^3.0'
doctrine-dbal-versions:
- '^3.0'
exclude:
- php: '8.1'
symfony-versions: '7.0.*'
Expand All @@ -36,8 +38,15 @@ jobs:
coverage: 'xdebug'
doctrine-orm-versions: '^3.0'
symfony-versions: '^7.0'
doctrine-dbal-versions: '^3.0'
- description: 'Doctrine dbal 4.0 test'
php: '8.2'
doctrine-orm-versions: '^3.0'
symfony-versions: '^7.0'
doctrine-dbal-versions: '^4.0'
coverage: 'none'

name: PHP ${{ matrix.php }} Symfony ${{ matrix.symfony-versions }} Doctrine ${{ matrix.doctrine-orm-versions }} ${{ matrix.description }}
name: PHP ${{ matrix.php }} Symfony ${{ matrix.symfony-versions }} Doctrine ${{ matrix.doctrine-orm-versions }} Doctrine Dbal ${{ matrix.doctrine-dbal-versions }} ${{ matrix.description }}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -73,6 +82,7 @@ jobs:
composer require symfony/dependency-injection:${{ matrix.symfony-versions }} --no-update --no-scripts
composer require symfony/http-kernel:${{ matrix.symfony-versions }} --no-update --no-scripts
composer require doctrine/orm:${{ matrix.doctrine-orm-versions }} --no-update --no-scripts
composer require doctrine/dbal:${{ matrix.doctrine-dbal-versions }} --no-update --no-scripts
composer require --dev symfony/console:${{ matrix.symfony-versions }} --no-update --no-scripts
composer require --dev symfony/property-access:${{ matrix.symfony-versions }} --no-update --no-scripts
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"theofidry/alice-data-fixtures": "^1.0",
"symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0 || ^7.0",
"symfony/http-kernel": "^4.4 || ^5.4 || ^6.0 || ^7.0",
"doctrine/dbal": "^2.0 || ^3.0"
"doctrine/dbal": "^2.0 || ^3.0 || ^4.0"
},
"require-dev": {
"phpstan/phpstan": "^1.2",
Expand Down
8 changes: 4 additions & 4 deletions src/Database/DatabaseManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
use BehatDoctrineFixtures\Database\Manager\ConsoleManager\SqliteConsoleManager;
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\Migrations\Metadata\Storage\TableMetadataStorageConfiguration;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -43,7 +43,7 @@ public function createDatabaseManager(
$databasePlatform = $entityManager->getConnection()->getDatabasePlatform();
$connection = $entityManager->getConnection();

if ($databasePlatform instanceof SqlitePlatform) {
if ($databasePlatform instanceof SQLitePlatform) {
$consoleManager = new SqliteConsoleManager();
return new SqliteDatabaseManager(
$consoleManager,
Expand All @@ -55,7 +55,7 @@ public function createDatabaseManager(
);
}

if ($databasePlatform instanceof PostgreSQL100Platform) {
if ($databasePlatform instanceof PostgreSQLPlatform) {
$consoleManager = new PostgreConsoleManager($this->cacheDir, $runMigrationCommand);
$purger = new ORMPurger($entityManager);
$executor = new ORMExecutor($entityManager, $purger);
Expand Down
11 changes: 0 additions & 11 deletions tests/Unit/Database/DatabaseManager/DatabaseManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,8 @@

namespace BehatDoctrineFixtures\Tests\Unit\Database\DatabaseManager;

use BehatDoctrineFixtures\Database\DatabaseManagerFactory;
use BehatDoctrineFixtures\Database\Exception\DatabaseManagerNotFoundForCurrentPlatform;
use BehatDoctrineFixtures\Database\Manager\DatabaseManager;
use BehatDoctrineFixtures\Database\Manager\PostgreSQLDatabaseManager;
use BehatDoctrineFixtures\Database\Manager\SqliteDatabaseManager;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use ReflectionClass;

final class DatabaseManagerTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
use BehatDoctrineFixtures\Database\Manager\PostgreSQLDatabaseManager;
use BehatDoctrineFixtures\Tests\Unit\Database\AbstractDatabaseManagerTest;
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Result;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;

final class PostgreSQLDatabaseManagerTest extends AbstractDatabaseManagerTest
Expand Down Expand Up @@ -52,7 +49,7 @@ public function testSaveBackupSuccess()
);

$connection = $this->createConnectionMockWithPlatformAndParams(
PostgreSQL100Platform::class,
PostgreSQLPlatform::class,
[
'password' => $password,
'user' => $user,
Expand Down Expand Up @@ -119,7 +116,7 @@ public function testLoadBackupSuccess()
->method('purge');

$connection = $this->createConnectionMockWithPlatformAndParams(
PostgreSQL100Platform::class,
PostgreSQLPlatform::class,
[
'password' => $password,
'user' => $user,
Expand Down Expand Up @@ -181,7 +178,7 @@ public function testPrepareSchemaWithNotCreatedSchema(): void
);

$connection = $this->createConnectionMockWithPlatformAndParams(
PostgreSQL100Platform::class,
PostgreSQLPlatform::class,
[
'password' => $password,
'user' => $user,
Expand Down Expand Up @@ -250,7 +247,7 @@ public function testPrepareSchemaWithCreatedSchema(): void
);

$connection = $this->createConnectionMockWithPlatformAndParams(
PostgreSQL100Platform::class,
PostgreSQLPlatform::class,
[
'password' => $password,
'user' => $user,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use BehatDoctrineFixtures\Database\Manager\ConsoleManager\SqliteConsoleManager;
use BehatDoctrineFixtures\Database\Manager\SqliteDatabaseManager;
use BehatDoctrineFixtures\Tests\Unit\Database\AbstractDatabaseManagerTest;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;

Expand All @@ -31,7 +31,7 @@ public function testSaveBackupSuccess()

$connectionName = 'default';
$connection = $this->createConnectionMockWithPlatformAndParams(
PostgreSQL100Platform::class,
SQLitePlatform::class,
[
'path' => $databasePath
]
Expand Down Expand Up @@ -70,7 +70,7 @@ public function testLoadBackupSuccess(): void

$connectionName = 'default';
$connection = $this->createConnectionMockWithPlatformAndParams(
PostgreSQL100Platform::class,
SQLitePlatform::class,
[
'path' => $databasePath
]
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/Database/DatabaseManagerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
use BehatDoctrineFixtures\Database\Manager\PostgreSQLDatabaseManager;
use BehatDoctrineFixtures\Database\Manager\SqliteDatabaseManager;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\Migrations\Metadata\Storage\TableMetadataStorageConfiguration;
use Doctrine\ORM\EntityManagerInterface;
Expand All @@ -35,7 +34,7 @@ protected function setUp(): void

public function testCreatePostgreSQLDatabaseManagerSuccess(): void
{
$entityManager = $this->createEntityManagerMockWithPlatform(PostgreSQL100Platform::class);
$entityManager = $this->createEntityManagerMockWithPlatform(PostgreSQLPlatform::class);

$eventManager = self::createMock(EventManager::class);
$eventManager->expects(self::once())
Expand Down

0 comments on commit 1be53af

Please sign in to comment.