Code Duplication    Length = 17-19 lines in 2 locations

Tests/Repository/ContainerRepositoryFactoryTest.php 2 locations

@@ 17-33 (lines=17) @@
14
15
class ContainerRepositoryFactoryTest extends TestCase
16
{
17
    public function testGetRepositoryReturnsService()
18
    {
19
        if (! interface_exists(ContainerInterface::class)) {
20
            $this->markTestSkipped('Symfony 3.3 is needed for this feature.');
21
        }
22
23
        $em        = $this->createEntityManager(['Foo\CoolEntity' => 'my_repo']);
24
        $repo      = new StubRepository($em, new ClassMetadata(''));
25
        $container = $this->createContainer(['my_repo' => $repo]);
26
27
        $factory = new ContainerRepositoryFactory($container);
28
        $this->assertSame($repo, $factory->getRepository($em, 'Foo\CoolEntity'));
29
    }
30
31
    public function testGetRepositoryReturnsEntityRepository()
32
    {
33
        if (! interface_exists(ContainerInterface::class)) {
34
            $this->markTestSkipped('Symfony 3.3 is needed for this feature.');
35
        }
36
@@ 69-87 (lines=19) @@
66
     * @expectedException \RuntimeException
67
     * @expectedExceptionMessage The service "my_repo" must implement ObjectRepository (or extend a base class, like ServiceEntityRepository).
68
     */
69
    public function testServiceRepositoriesMustExtendObjectRepository()
70
    {
71
        if (! interface_exists(ContainerInterface::class)) {
72
            $this->markTestSkipped('Symfony 3.3 is needed for this feature.');
73
        }
74
75
        $repo = new \stdClass();
76
77
        $container = $this->createContainer(['my_repo' => $repo]);
78
79
        $em = $this->createEntityManager(['Foo\CoolEntity' => 'my_repo']);
80
81
        $factory = new ContainerRepositoryFactory($container);
82
        $factory->getRepository($em, 'Foo\CoolEntity');
83
    }
84
85
    public function testServiceRepositoriesCanNotExtendsEntityRepository()
86
    {
87
        if (! interface_exists(ContainerInterface::class)) {
88
            $this->markTestSkipped('Symfony 3.3 is needed for this feature.');
89
        }
90