Skip to content

Commit e0250f6

Browse files
[DoctrineBridge] fix tests
1 parent 6b5c8cb commit e0250f6

File tree

3 files changed

+7
-26
lines changed

3 files changed

+7
-26
lines changed

Tests/IdGenerator/EntityManager.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

Tests/IdGenerator/UlidGeneratorTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Tests\IdGenerator;
1313

14+
use Doctrine\ORM\EntityManager;
1415
use Doctrine\ORM\Mapping\Entity;
1516
use PHPUnit\Framework\TestCase;
1617
use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;
@@ -21,7 +22,7 @@ class UlidGeneratorTest extends TestCase
2122
{
2223
public function testUlidCanBeGenerated()
2324
{
24-
$em = new EntityManager();
25+
$em = (new \ReflectionClass(EntityManager::class))->newInstanceWithoutConstructor();
2526
$generator = new UlidGenerator();
2627
$ulid = $generator->generate($em, new Entity());
2728

@@ -35,7 +36,7 @@ public function testUlidCanBeGenerated()
3536
public function testUlidFactory()
3637
{
3738
$ulid = new Ulid('00000000000000000000000000');
38-
$em = new EntityManager();
39+
$em = (new \ReflectionClass(EntityManager::class))->newInstanceWithoutConstructor();
3940
$factory = $this->createMock(UlidFactory::class);
4041
$factory->expects($this->any())
4142
->method('create')

Tests/IdGenerator/UuidGeneratorTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Tests\IdGenerator;
1313

14+
use Doctrine\ORM\EntityManager;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
1617
use Symfony\Component\Uid\Factory\UuidFactory;
@@ -25,7 +26,7 @@ class UuidGeneratorTest extends TestCase
2526
{
2627
public function testUuidCanBeGenerated()
2728
{
28-
$em = new EntityManager();
29+
$em = (new \ReflectionClass(EntityManager::class))->newInstanceWithoutConstructor();
2930
$generator = new UuidGenerator();
3031
$uuid = $generator->generate($em, new Entity());
3132

@@ -35,7 +36,7 @@ public function testUuidCanBeGenerated()
3536
public function testCustomUuidfactory()
3637
{
3738
$uuid = new UuidV4();
38-
$em = new EntityManager();
39+
$em = (new \ReflectionClass(EntityManager::class))->newInstanceWithoutConstructor();
3940
$factory = $this->createMock(UuidFactory::class);
4041
$factory->expects($this->any())
4142
->method('create')
@@ -47,7 +48,7 @@ public function testCustomUuidfactory()
4748

4849
public function testUuidfactory()
4950
{
50-
$em = new EntityManager();
51+
$em = (new \ReflectionClass(EntityManager::class))->newInstanceWithoutConstructor();
5152
$generator = new UuidGenerator();
5253
$this->assertInstanceOf(UuidV6::class, $generator->generate($em, new Entity()));
5354

0 commit comments

Comments
 (0)