diff --git a/example/test/Unit/AbstractTestCase.php b/example/test/Unit/AbstractTestCase.php index 710241ac..2b34f785 100644 --- a/example/test/Unit/AbstractTestCase.php +++ b/example/test/Unit/AbstractTestCase.php @@ -13,6 +13,7 @@ namespace Example\Test\Unit; +use Doctrine\DBAL; use Doctrine\ORM; use Ergebnis\FactoryBot; use Faker\Factory; @@ -23,17 +24,19 @@ abstract class AbstractTestCase extends Framework\TestCase { final protected static function entityManager(): ORM\EntityManagerInterface { + $connection = DBAL\DriverManager::getConnection([ + 'driver' => 'pdo_sqlite', + 'path' => ':memory:', + ]); + $configuration = ORM\ORMSetup::createConfiguration(true); $configuration->setMetadataDriverImpl(new ORM\Mapping\Driver\AttributeDriver([ __DIR__ . '/../../src/Entity', ])); - $entityManager = ORM\EntityManager::create( - [ - 'driver' => 'pdo_sqlite', - 'path' => ':memory:', - ], + $entityManager = new ORM\EntityManager( + $connection, $configuration, ); diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 6f85d07d..313e3f6a 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -128,14 +128,6 @@ parameters: count: 1 path: example/test/AutoReview/FixtureTest.php - - - message: """ - #^Call to deprecated method create\\(\\) of class Doctrine\\\\ORM\\\\EntityManager\\: - Use \\{@see DriverManager\\:\\:getConnection\\(\\)\\} to bootstrap the connection and call the constructor\\.$# - """ - count: 1 - path: example/test/Unit/AbstractTestCase.php - - message: "#^Instanceof between Ergebnis\\\\FactoryBot\\\\FieldDefinition\\\\Resolvable and Ergebnis\\\\FactoryBot\\\\FieldDefinition\\\\Resolvable will always evaluate to true\\.$#" count: 1 @@ -551,11 +543,3 @@ parameters: count: 1 path: test/Unit/FixtureFactoryTest.php - - - message: """ - #^Call to deprecated method create\\(\\) of class Doctrine\\\\ORM\\\\EntityManager\\: - Use \\{@see DriverManager\\:\\:getConnection\\(\\)\\} to bootstrap the connection and call the constructor\\.$# - """ - count: 1 - path: test/Util/Doctrine/ORM/EntityManagerFactory.php - diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 5d6c9056..69680892 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -75,17 +75,6 @@ ProjectDefinitionProvider - - - 'pdo_sqlite', - 'path' => ':memory:', - ], - $configuration, - )]]> - - Entity\User @@ -444,15 +433,4 @@ $resolved - - - 'pdo_sqlite', - 'path' => ':memory:', - ], - $configuration, - )]]> - - diff --git a/test/Util/Doctrine/ORM/EntityManagerFactory.php b/test/Util/Doctrine/ORM/EntityManagerFactory.php index 46c6816d..f356a6e2 100644 --- a/test/Util/Doctrine/ORM/EntityManagerFactory.php +++ b/test/Util/Doctrine/ORM/EntityManagerFactory.php @@ -13,23 +13,26 @@ namespace Ergebnis\FactoryBot\Test\Util\Doctrine\ORM; +use Doctrine\DBAL; use Doctrine\ORM; final class EntityManagerFactory { public static function create(): ORM\EntityManagerInterface { + $connection = DBAL\DriverManager::getConnection([ + 'driver' => 'pdo_sqlite', + 'path' => ':memory:', + ]); + $configuration = ORM\ORMSetup::createConfiguration(true); $configuration->setMetadataDriverImpl(new ORM\Mapping\Driver\AttributeDriver([ __DIR__ . '/../../../../example/src/Entity', ])); - return ORM\EntityManager::create( - [ - 'driver' => 'pdo_sqlite', - 'path' => ':memory:', - ], + return new ORM\EntityManager( + $connection, $configuration, ); }