Code Duplication    Length = 36-36 lines in 2 locations

src/Component/Resource/Tests/Repository/Doctrine/ORM/RepositoryFactoryTest.php 1 location

@@ 53-88 (lines=36) @@
50
        $this->assertInstanceOf(RepositoryFactoryInterface::class, $this->repositoryFactory);
51
    }
52
53
    public function testRepository()
54
    {
55
        $entityManager = $this->createEntityManagerMock();
56
        $entityManager
57
            ->expects($this->exactly(3))
58
            ->method('getClassMetadata')
59
            ->with($this->identicalTo($entityName = 'entity'))
60
            ->will($this->returnValue($classMetadata = $this->createClassMetadataMock()));
61
62
        $entityManager
63
            ->expects($this->once())
64
            ->method('getConfiguration')
65
            ->will($this->returnValue($configuration = $this->createConfigurationMock()));
66
67
        $configuration
68
            ->expects($this->once())
69
            ->method('getDefaultRepositoryClassName')
70
            ->will($this->returnValue($repositoryClass = EntityRepository::class));
71
72
        $classMetadata
73
            ->expects($this->exactly(3))
74
            ->method('getName')
75
            ->will($this->returnValue($entityName));
76
77
        $this->resourceRegistry
78
            ->expects($this->once())
79
            ->method('getIterator')
80
            ->will($this->returnValue(new \ArrayIterator([])));
81
82
        $this->assertInstanceOf(
83
            $repositoryClass,
84
            $repository = $this->repositoryFactory->getRepository($entityManager, $entityName)
85
        );
86
87
        $this->assertSame($repository, $this->repositoryFactory->getRepository($entityManager, $entityName));
88
    }
89
90
    public function testResourceRepository()
91
    {

src/Component/Translation/Tests/Repository/Doctrine/ORM/TranslatableRepositoryFactoryTest.php 1 location

@@ 85-120 (lines=36) @@
82
        $this->assertInstanceOf(RepositoryFactory::class, $this->repositoryFactory);
83
    }
84
85
    public function testRepository()
86
    {
87
        $entityManager = $this->createEntityManagerMock();
88
        $entityManager
89
            ->expects($this->exactly(3))
90
            ->method('getClassMetadata')
91
            ->with($this->identicalTo($entityName = 'entity'))
92
            ->will($this->returnValue($classMetadata = $this->createClassMetadataMock()));
93
94
        $entityManager
95
            ->expects($this->once())
96
            ->method('getConfiguration')
97
            ->will($this->returnValue($configuration = $this->createConfigurationMock()));
98
99
        $configuration
100
            ->expects($this->once())
101
            ->method('getDefaultRepositoryClassName')
102
            ->will($this->returnValue($repositoryClass = EntityRepository::class));
103
104
        $classMetadata
105
            ->expects($this->exactly(3))
106
            ->method('getName')
107
            ->will($this->returnValue($model = 'name'));
108
109
        $this->resourceRegistry
110
            ->expects($this->once())
111
            ->method('getIterator')
112
            ->will($this->returnValue(new \ArrayIterator([])));
113
114
        $this->assertInstanceOf(
115
            $repositoryClass,
116
            $repository = $this->repositoryFactory->getRepository($entityManager, $entityName)
117
        );
118
119
        $this->assertSame($repository, $this->repositoryFactory->getRepository($entityManager, $entityName));
120
    }
121
122
    public function testResourceRepository()
123
    {