Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(test): Stop using EntityManager::create() method. Use constructor instead. #1522

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions tests/Metadata/Driver/DoctrineDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
namespace JMS\Serializer\Tests\Metadata\Driver;

use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\DBAL\DriverManager;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\Driver\AnnotationDriver as DoctrineAnnotationDriver;
use Doctrine\ORM\Mapping\Driver\AttributeDriver as DoctrineAttributeDriver;
use Doctrine\ORM\Version as ORMVersion;
use Doctrine\Persistence\ManagerRegistry;
use JMS\Serializer\Metadata\Driver\AnnotationDriver;
use JMS\Serializer\Metadata\Driver\AnnotationOrAttributeDriver;
Expand All @@ -31,10 +31,6 @@ public function getMetadata()

public function testMetadataForEmbedded()
{
if (ORMVersion::compare('2.5') >= 0) {
$this->markTestSkipped('Not using Doctrine ORM >= 2.5 with Embedded entities');
}

$refClass = new \ReflectionClass(BlogPostWithEmbedded::class);
$meta = $this->getDoctrineDriver()->loadMetadataForClass($refClass);
self::assertNotNull($meta);
Expand Down Expand Up @@ -149,12 +145,12 @@ protected function getEntityManager()
);
}

$conn = [
$conn = DriverManager::getConnection([
'driver' => 'pdo_sqlite',
'memory' => true,
];
]);

return EntityManager::create($conn, $config);
return new EntityManager($conn, $config);
}

public function getMetadataDriver()
Expand Down
2 changes: 1 addition & 1 deletion tests/Serializer/Doctrine/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private function createEntityManager(Connection $con)
$cfg->setProxyNamespace('JMS\Serializer\DoctrineProxy');
$cfg->setProxyDir(sys_get_temp_dir() . '/serializer-test-proxies');

return EntityManager::create($con, $cfg);
return new EntityManager($con, $cfg);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Serializer/Doctrine/ObjectConstructorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ private function createEntityManager(Connection $con, ?Configuration $cfg = null
$cfg->setProxyNamespace('JMS\Serializer\DoctrineProxy');
$cfg->setProxyDir(sys_get_temp_dir() . '/serializer-test-proxies');

return EntityManager::create($con, $cfg);
return new EntityManager($con, $cfg);
}

/**
Expand Down
Loading