Code Duplication    Length = 16-16 lines in 2 locations

Tests/Repository/ContainerRepositoryFactoryTest.php 2 locations

@@ 99-114 (lines=16) @@
96
     * @expectedException \RuntimeException
97
     * @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".
98
     */
99
    public function testRepositoryMatchesServiceInterfaceButServiceNotFound()
100
    {
101
        if (interface_exists(ContainerInterface::class)) {
102
            $container = $this->createContainer(array());
103
        } else {
104
            // Symfony 3.2 and lower support
105
            $container = null;
106
        }
107
108
        $em = $this->createEntityManager(array(
109
            'Foo\CoolEntity' => StubServiceRepository::class
110
        ));
111
112
        $factory = new ContainerRepositoryFactory($container);
113
        $factory->getRepository($em, 'Foo\CoolEntity');
114
    }
115
116
    /**
117
     * @expectedException \RuntimeException
@@ 120-135 (lines=16) @@
117
     * @expectedException \RuntimeException
118
     * @expectedExceptionMessage The "Foo\CoolEntity" entity has a repositoryClass set to "not_a_real_class", but this is not a valid class. Check your class naming. If this is meant to be a service id, make sure this service exists and is tagged with "doctrine.repository_service".
119
     */
120
    public function testCustomRepositoryIsNotAValidClass()
121
    {
122
        if (interface_exists(ContainerInterface::class)) {
123
            $container = $this->createContainer(array());
124
        } else {
125
            // Symfony 3.2 and lower support
126
            $container = null;
127
        }
128
129
        $em = $this->createEntityManager(array(
130
            'Foo\CoolEntity' => 'not_a_real_class'
131
        ));
132
133
        $factory = new ContainerRepositoryFactory($container);
134
        $factory->getRepository($em, 'Foo\CoolEntity');
135
    }
136
137
    private function createContainer(array $services)
138
    {