Skip to content

Commit 9cbab67

Browse files
committed
Merge branch '7.0' into 7.1
* 7.0: (29 commits) fix tests add missing method fix merge fix test fix merge fix test change test to use a real ObjectManager [Mailer] Document the usage of custom headers in Infobip bridge [SecurityBundle] Add `provider` XML attribute to the authenticators it’s missing from [DoctrineBridge] Test reset with a true manager Sync php-cs-fixer config file with 7.2 [HttpClient] Fix parsing SSE [Notifier] Fix thread key in GoogleChat bridge [HttpKernel][Security] Fix accessing session for stateless request [Serializer] Fix `ObjectNormalizer` with property path test handling of special "value" constraint option [PhpUnitBridge] Add missing import [FrameworkBundle] Fix setting default context for certain normalizers [57251] Missing translations for Romanian (ro) [ErrorHandler] Fix rendered exception code highlighting on PHP 8.3 ...
2 parents b7ae744 + 90ded9f commit 9cbab67

File tree

2 files changed

+79
-8
lines changed

2 files changed

+79
-8
lines changed

Tests/Fixtures/DummyManager.php

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
3+
namespace Symfony\Bridge\Doctrine\Tests\Fixtures;
4+
5+
use Doctrine\Persistence\Mapping\ClassMetadata;
6+
use Doctrine\Persistence\Mapping\ClassMetadataFactory;
7+
use Doctrine\Persistence\ObjectManager;
8+
use Doctrine\Persistence\ObjectRepository;
9+
10+
class DummyManager implements ObjectManager
11+
{
12+
public $bar;
13+
14+
public function find($className, $id): ?object
15+
{
16+
}
17+
18+
public function persist($object): void
19+
{
20+
}
21+
22+
public function remove($object): void
23+
{
24+
}
25+
26+
public function merge($object)
27+
{
28+
}
29+
30+
public function clear($objectName = null): void
31+
{
32+
}
33+
34+
public function detach($object): void
35+
{
36+
}
37+
38+
public function refresh($object): void
39+
{
40+
}
41+
42+
public function flush(): void
43+
{
44+
}
45+
46+
public function getRepository($className): ObjectRepository
47+
{
48+
}
49+
50+
public function getClassMetadata($className): ClassMetadata
51+
{
52+
}
53+
54+
public function getMetadataFactory(): ClassMetadataFactory
55+
{
56+
}
57+
58+
public function initializeObject($obj): void
59+
{
60+
}
61+
62+
public function contains($object): bool
63+
{
64+
}
65+
66+
public function isUninitializedObject($value): bool
67+
{
68+
}
69+
}

Tests/ManagerRegistryTest.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Tests;
1313

14+
use Doctrine\Persistence\ObjectManager;
1415
use PHPUnit\Framework\TestCase;
16+
use Symfony\Bridge\Doctrine\Tests\Fixtures\DummyManager;
1517
use Symfony\Component\DependencyInjection\ContainerBuilder;
1618
use Symfony\Component\DependencyInjection\ContainerInterface;
1719
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
@@ -24,8 +26,8 @@ public static function setUpBeforeClass(): void
2426
{
2527
$container = new ContainerBuilder();
2628

27-
$container->register('foo', \stdClass::class)->setPublic(true);
28-
$container->getDefinition('foo')->setLazy(true)->addTag('proxy', ['interface' => \stdClass::class]);
29+
$container->register('foo', DummyManager::class)->setPublic(true);
30+
$container->getDefinition('foo')->setLazy(true)->addTag('proxy', ['interface' => ObjectManager::class]);
2931
$container->compile();
3032

3133
$dumper = new PhpDumper($container);
@@ -46,8 +48,8 @@ public function testResetService()
4648
$registry->resetManager();
4749

4850
$this->assertSame($foo, $container->get('foo'));
49-
$this->assertInstanceOf(\stdClass::class, $foo);
50-
$this->assertFalse(property_exists($foo, 'bar'));
51+
$this->assertInstanceOf(ObjectManager::class, $foo);
52+
$this->assertFalse(isset($foo->bar));
5153
}
5254

5355
/**
@@ -79,7 +81,7 @@ public function testResetServiceWillNotNestFurtherLazyServicesWithinEachOther()
7981

8082
$service = $container->get('foo');
8183

82-
self::assertInstanceOf(\stdClass::class, $service);
84+
self::assertInstanceOf(ObjectManager::class, $service);
8385
self::assertInstanceOf(LazyObjectInterface::class, $service);
8486
self::assertFalse($service->isLazyObjectInitialized());
8587

@@ -92,7 +94,7 @@ public function testResetServiceWillNotNestFurtherLazyServicesWithinEachOther()
9294
$service->initializeLazyObject();
9395

9496
$wrappedValue = $service->initializeLazyObject();
95-
self::assertInstanceOf(\stdClass::class, $wrappedValue);
97+
self::assertInstanceOf(DummyManager::class, $wrappedValue);
9698
self::assertNotInstanceOf(LazyObjectInterface::class, $wrappedValue);
9799
}
98100

@@ -104,10 +106,10 @@ private function dumpLazyServiceDoctrineBridgeContainerAsFiles()
104106

105107
$container = new ContainerBuilder();
106108

107-
$container->register('foo', \stdClass::class)
109+
$container->register('foo', DummyManager::class)
108110
->setPublic(true)
109111
->setLazy(true)
110-
->addTag('proxy', ['interface' => \stdClass::class]);
112+
->addTag('proxy', ['interface' => ObjectManager::class]);
111113
$container->compile();
112114

113115
$fileSystem = new Filesystem();

0 commit comments

Comments
 (0)