From 078217eeb7313e7610120ea03992ab8b7110300b Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Wed, 7 Feb 2024 23:24:00 +0100 Subject: [PATCH] Do not longer use EntityManager::create() in tests --- tests/DoctrineIntegration/ORM/entity-manager.php | 7 ++++--- tests/Rules/DeadCode/entity-manager.php | 7 ++++--- tests/Rules/Doctrine/ORM/entity-manager.php | 7 ++++--- tests/Rules/Properties/entity-manager.php | 7 ++++--- tests/Type/Doctrine/data/QueryResult/entity-manager.php | 7 ++++--- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/tests/DoctrineIntegration/ORM/entity-manager.php b/tests/DoctrineIntegration/ORM/entity-manager.php index c5244885..23f27436 100644 --- a/tests/DoctrineIntegration/ORM/entity-manager.php +++ b/tests/DoctrineIntegration/ORM/entity-manager.php @@ -2,6 +2,7 @@ use Cache\Adapter\PHPArray\ArrayCachePool; use Doctrine\Common\Annotations\AnnotationReader; +use Doctrine\DBAL\DriverManager; use Doctrine\ORM\Configuration; use Doctrine\ORM\EntityManager; use Doctrine\ORM\Mapping\Driver\AnnotationDriver; @@ -18,10 +19,10 @@ ) ); -return EntityManager::create( - [ +return new EntityManager( + DriverManager::getConnection([ 'driver' => 'pdo_sqlite', 'memory' => true, - ], + ]), $config ); diff --git a/tests/Rules/DeadCode/entity-manager.php b/tests/Rules/DeadCode/entity-manager.php index 6e9b4f9e..bc0d5ccb 100644 --- a/tests/Rules/DeadCode/entity-manager.php +++ b/tests/Rules/DeadCode/entity-manager.php @@ -2,6 +2,7 @@ use Cache\Adapter\PHPArray\ArrayCachePool; use Doctrine\Common\Annotations\AnnotationReader; +use Doctrine\DBAL\DriverManager; use Doctrine\ORM\Configuration; use Doctrine\ORM\EntityManager; use Doctrine\ORM\Mapping\Driver\AnnotationDriver; @@ -27,10 +28,10 @@ $config->setMetadataDriverImpl($metadataDriver); -return EntityManager::create( - [ +return new EntityManager( + DriverManager::getConnection([ 'driver' => 'pdo_sqlite', 'memory' => true, - ], + ]), $config ); diff --git a/tests/Rules/Doctrine/ORM/entity-manager.php b/tests/Rules/Doctrine/ORM/entity-manager.php index 0fc8a657..9181f8b8 100644 --- a/tests/Rules/Doctrine/ORM/entity-manager.php +++ b/tests/Rules/Doctrine/ORM/entity-manager.php @@ -2,6 +2,7 @@ use Cache\Adapter\PHPArray\ArrayCachePool; use Doctrine\Common\Annotations\AnnotationReader; +use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Types\DateTimeImmutableType; use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Configuration; @@ -35,10 +36,10 @@ DateTimeImmutableType::class ); -return EntityManager::create( - [ +return new EntityManager( + DriverManager::getConnection([ 'driver' => 'pdo_sqlite', 'memory' => true, - ], + ]), $config ); diff --git a/tests/Rules/Properties/entity-manager.php b/tests/Rules/Properties/entity-manager.php index 9a34a8b8..99f7a07e 100644 --- a/tests/Rules/Properties/entity-manager.php +++ b/tests/Rules/Properties/entity-manager.php @@ -2,6 +2,7 @@ use Cache\Adapter\PHPArray\ArrayCachePool; use Doctrine\Common\Annotations\AnnotationReader; +use Doctrine\DBAL\DriverManager; use Doctrine\ORM\Configuration; use Doctrine\ORM\EntityManager; use Doctrine\ORM\Mapping\Driver\AnnotationDriver; @@ -28,10 +29,10 @@ $config->setMetadataDriverImpl($metadataDriver); -return EntityManager::create( - [ +return new EntityManager( + DriverManager::getConnection([ 'driver' => 'pdo_sqlite', 'memory' => true, - ], + ]), $config ); diff --git a/tests/Type/Doctrine/data/QueryResult/entity-manager.php b/tests/Type/Doctrine/data/QueryResult/entity-manager.php index 5b46dc91..c9ba38af 100644 --- a/tests/Type/Doctrine/data/QueryResult/entity-manager.php +++ b/tests/Type/Doctrine/data/QueryResult/entity-manager.php @@ -2,6 +2,7 @@ use Cache\Adapter\PHPArray\ArrayCachePool; use Doctrine\Common\Annotations\AnnotationReader; +use Doctrine\DBAL\DriverManager; use Doctrine\ORM\Configuration; use Doctrine\ORM\EntityManager; use Doctrine\ORM\Mapping\Column; @@ -30,10 +31,10 @@ $config->setMetadataDriverImpl($metadataDriver); -return EntityManager::create( - [ +return new EntityManager( + DriverManager::getConnection([ 'driver' => 'pdo_sqlite', 'memory' => true, - ], + ]), $config );