Code Duplication    Length = 17-19 lines in 2 locations

Tests/Repository/ContainerRepositoryFactoryTest.php 2 locations

@@ 16-32 (lines=17) @@
13
14
class ContainerRepositoryFactoryTest extends TestCase
15
{
16
    public function testGetRepositoryReturnsService()
17
    {
18
        if (! interface_exists(ContainerInterface::class)) {
19
            $this->markTestSkipped('Symfony 3.3 is needed for this feature.');
20
        }
21
22
        $em        = $this->createEntityManager(['Foo\CoolEntity' => 'my_repo']);
23
        $repo      = new StubRepository($em, new ClassMetadata(''));
24
        $container = $this->createContainer(['my_repo' => $repo]);
25
26
        $factory = new ContainerRepositoryFactory($container);
27
        $this->assertSame($repo, $factory->getRepository($em, 'Foo\CoolEntity'));
28
    }
29
30
    public function testGetRepositoryReturnsEntityRepository()
31
    {
32
        if (! interface_exists(ContainerInterface::class)) {
33
            $this->markTestSkipped('Symfony 3.3 is needed for this feature.');
34
        }
35
@@ 68-86 (lines=19) @@
65
     * @expectedException \RuntimeException
66
     * @expectedExceptionMessage The service "my_repo" must extend EntityRepository (or a base class, like ServiceEntityRepository).
67
     */
68
    public function testServiceRepositoriesMustExtendEntityRepository()
69
    {
70
        if (! interface_exists(ContainerInterface::class)) {
71
            $this->markTestSkipped('Symfony 3.3 is needed for this feature.');
72
        }
73
74
        $repo = new \stdClass();
75
76
        $container = $this->createContainer(['my_repo' => $repo]);
77
78
        $em = $this->createEntityManager(['Foo\CoolEntity' => 'my_repo']);
79
80
        $factory = new ContainerRepositoryFactory($container);
81
        $factory->getRepository($em, 'Foo\CoolEntity');
82
    }
83
84
    /**
85
     * @expectedException \RuntimeException
86
     * @expectedExceptionMessage The "Doctrine\Bundle\DoctrineBundle\Tests\Repository\StubServiceRepository" entity repository implements "Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface", but its service could not be found. Make sure the service exists and is tagged with "doctrine.repository_service".
87
     */
88
    public function testRepositoryMatchesServiceInterfaceButServiceNotFound()
89
    {