1212namespace Symfony \Cmf \Component \Testing \Tests \Functional ;
1313
1414use Doctrine \Bundle \PHPCRBundle \Initializer \InitializerManager ;
15+ use Doctrine \Bundle \PHPCRBundle \ManagerRegistry ;
1516use Doctrine \Bundle \PHPCRBundle \ManagerRegistryInterface ;
1617use Doctrine \Bundle \PHPCRBundle \Test \RepositoryManager ;
1718use PHPUnit \Framework \MockObject \MockObject ;
2122use Symfony \Cmf \Component \Testing \Functional \BaseTestCase ;
2223use Symfony \Cmf \Component \Testing \Functional \DbManager \PHPCR ;
2324use Symfony \Cmf \Component \Testing \Tests \Fixtures \TestTestCase ;
25+ use Symfony \Component \DependencyInjection \Container ;
2426use Symfony \Component \DependencyInjection \ContainerInterface ;
27+ use Symfony \Component \HttpKernel \Kernel ;
2528use Symfony \Component \HttpKernel \KernelInterface ;
2629
2730class BaseTestCaseTest extends TestCase
@@ -48,13 +51,18 @@ class BaseTestCaseTest extends TestCase
4851
4952 protected function setUp (): void
5053 {
51- $ this ->container = $ this ->createMock (ContainerInterface::class);
54+ $ managerRegistry = interface_exists (ManagerRegistryInterface::class)
55+ ? $ this ->createMock (ManagerRegistryInterface::class)
56+ : $ this ->createMock (ManagerRegistry::class)
57+ ;
58+ $ this ->container = Kernel::MAJOR_VERSION >= 7 ? $ this ->createMock (Container::class) : $ this ->createMock (ContainerInterface::class);
5259 $ this ->container
5360 ->method ('get ' )
54- ->willReturnCallback (function ($ name ) {
61+ ->willReturnCallback (function ($ name ) use ( $ managerRegistry ) {
5562 $ dic = [
5663 'test.client ' => $ this ->client ,
57- 'doctrine_phpcr ' => $ this ->createMock (ManagerRegistryInterface::class),
64+ 'test.service_container ' => $ this ->container ,
65+ 'doctrine_phpcr ' => $ managerRegistry ,
5866 'doctrine_phpcr.initializer_manager ' => $ this ->createMock (InitializerManager::class),
5967 ];
6068
@@ -85,15 +93,6 @@ protected function setUp(): void
8593 ->willReturn ($ this ->container );
8694 }
8795
88- public function testGetContainer ()
89- {
90- $ class = new \ReflectionClass (BaseTestCase::class);
91- $ method = $ class ->getMethod ('getContainer ' );
92- $ method ->setAccessible (true );
93-
94- $ this ->assertEquals ($ this ->container , $ method ->invoke (null ));
95- }
96-
9796 public function testGetKernel ()
9897 {
9998 $ class = new \ReflectionClass (BaseTestCase::class);
@@ -128,8 +127,6 @@ public function provideTestDb()
128127
129128 /**
130129 * @dataProvider provideTestDb
131- *
132- * @depends testGetContainer
133130 */
134131 public function testDb ($ dbName , $ expected )
135132 {
0 commit comments