Code Duplication    Length = 28-28 lines in 2 locations

src/Bundle/ResourceBundle/Tests/EventSubscriber/Doctrine/MongoDB/ResourceSubscriberTest.php 1 location

@@ 264-291 (lines=28) @@
261
        $this->assertFalse($classMetadata->isMappedSuperclass);
262
    }
263
264
    public function testLoadClassMetadataWithoutResource()
265
    {
266
        $event = $this->createLoadClassMetadataEventArgsMock();
267
        $event
268
            ->expects($this->once())
269
            ->method('getClassMetadata')
270
            ->will($this->returnValue($classMetadata = $this->createClassMetadataMock()));
271
272
        $classMetadata
273
            ->expects($this->once())
274
            ->method('getName')
275
            ->will($this->returnValue($model = 'model'));
276
277
        $this->serviceRegistry
278
            ->expects($this->once())
279
            ->method('getIterator')
280
            ->will($this->returnValue(new \ArrayIterator([])));
281
282
        $classMetadata
283
            ->expects($this->never())
284
            ->method('setCustomRepositoryClass');
285
286
        $classMetadata->isMappedSuperclass = true;
287
288
        $this->resourceSubscriber->loadClassMetadata($event);
289
290
        $this->assertTrue($classMetadata->isMappedSuperclass);
291
    }
292
293
    /**
294
     * @return \PHPUnit_Framework_MockObject_MockObject|RegistryInterface

src/Bundle/ResourceBundle/Tests/EventSubscriber/Doctrine/ORM/ResourceSubscriberTest.php 1 location

@@ 260-287 (lines=28) @@
257
        $this->assertFalse($classMetadata->isMappedSuperclass);
258
    }
259
260
    public function testLoadClassMetadataWithoutResource()
261
    {
262
        $event = $this->createLoadClassMetadataEventArgsMock();
263
        $event
264
            ->expects($this->once())
265
            ->method('getClassMetadata')
266
            ->will($this->returnValue($classMetadata = $this->createClassMetadataMock()));
267
268
        $classMetadata
269
            ->expects($this->once())
270
            ->method('getName')
271
            ->will($this->returnValue($model = 'model'));
272
273
        $this->serviceRegistry
274
            ->expects($this->once())
275
            ->method('getIterator')
276
            ->will($this->returnValue(new \ArrayIterator([])));
277
278
        $classMetadata
279
            ->expects($this->never())
280
            ->method('setCustomRepositoryClass');
281
282
        $classMetadata->isMappedSuperclass = true;
283
284
        $this->resourceSubscriber->loadClassMetadata($event);
285
286
        $this->assertTrue($classMetadata->isMappedSuperclass);
287
    }
288
289
    /**
290
     * @return \PHPUnit_Framework_MockObject_MockObject|RegistryInterface