From 9d3a0a6733ecf1c7bed34a783e79d92baf207292 Mon Sep 17 00:00:00 2001 From: Maxime Veber Date: Fri, 12 Oct 2018 10:30:09 +0200 Subject: [PATCH] Fix compatibility with older versions Older versions of PHP does not support the current implementation so I changed it. Also in order to be able to run the test suite with old versions of Doctrine, this change was also required (because the interface differ). --- Tests/Repository/ContainerRepositoryFactoryTest.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Tests/Repository/ContainerRepositoryFactoryTest.php b/Tests/Repository/ContainerRepositoryFactoryTest.php index b6d0aea36..2ff96dff5 100644 --- a/Tests/Repository/ContainerRepositoryFactoryTest.php +++ b/Tests/Repository/ContainerRepositoryFactoryTest.php @@ -88,7 +88,7 @@ public function testServiceRepositoriesCanNotExtendsEntityRepository() $this->markTestSkipped('Symfony 3.3 is needed for this feature.'); } - $repo = new StubCustomRepository(); + $repo = $this->getMockBuilder(ObjectRepository::class)->getMock(); $container = $this->createContainer(['my_repo' => $repo]); @@ -97,7 +97,7 @@ public function testServiceRepositoriesCanNotExtendsEntityRepository() $factory = new ContainerRepositoryFactory($container); $factory->getRepository($em, 'Foo\CoolEntity'); $actualRepo = $factory->getRepository($em, 'Foo\CoolEntity'); - $this->assertInstanceOf(StubCustomRepository::class, $actualRepo); + $this->assertSame($repo, $actualRepo); } @@ -189,12 +189,3 @@ class StubRepository extends EntityRepository class StubServiceRepository extends EntityRepository implements ServiceEntityRepositoryInterface { } - -class StubCustomRepository implements ObjectRepository -{ - public function find($id) {} - public function findAll() {} - public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null) {} - public function findOneBy(array $criteria) {} - public function getClassName() {} -}