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([
23
            'Foo\CoolEntity' => 'my_repo',
24
        ]);
25
        $repo = new StubRepository($em, new ClassMetadata(''));
26
        $container = $this->createContainer([
27
            'my_repo' => $repo,
28
        ]);
29
30
        $factory = new ContainerRepositoryFactory($container);
31
        $this->assertSame($repo, $factory->getRepository($em, 'Foo\CoolEntity'));
32
    }
33
34
    public function testGetRepositoryReturnsEntityRepository()
35
    {
@@ 74-92 (lines=19) @@
71
     * @expectedException \RuntimeException
72
     * @expectedExceptionMessage The service "my_repo" must extend EntityRepository (or a base class, like ServiceEntityRepository).
73
     */
74
    public function testServiceRepositoriesMustExtendEntityRepository()
75
    {
76
        if (!interface_exists(ContainerInterface::class)) {
77
            $this->markTestSkipped('Symfony 3.3 is needed for this feature.');
78
        }
79
80
        $repo = new \stdClass();
81
82
        $container = $this->createContainer([
83
            'my_repo' => $repo,
84
        ]);
85
86
        $em = $this->createEntityManager([
87
            'Foo\CoolEntity' => 'my_repo',
88
        ]);
89
90
        $factory = new ContainerRepositoryFactory($container);
91
        $factory->getRepository($em, 'Foo\CoolEntity');
92
    }
93
94
    /**
95
     * @expectedException \RuntimeException