Code Duplication    Length = 28-28 lines in 2 locations

tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php 2 locations

@@ 125-152 (lines=28) @@
122
    /**
123
     * @group DDC-2432
124
     */
125
    public function testFailedProxyLoadingDoesNotMarkTheProxyAsInitialized()
126
    {
127
        $classMetaData = $this->emMock->getClassMetadata(ECommerceFeature::class);
128
129
        $persister = $this
130
            ->getMockBuilder(BasicEntityPersister::class)
131
            ->setConstructorArgs([$this->emMock, $classMetaData])
132
            ->setMethods(['load'])
133
            ->getMock();
134
135
        $persister
136
            ->expects($this->atLeastOnce())
137
            ->method('load')
138
            ->will($this->returnValue(null));
139
140
        $this->uowMock->setEntityPersister(ECommerceFeature::class, $persister);
141
142
        /* @var $proxy GhostObjectInterface|ECommerceFeature */
143
        $proxy = $this->proxyFactory->getProxy(ECommerceFeature::class, ['id' => 42]);
144
145
        try {
146
            $proxy->getDescription();
147
            $this->fail('An exception was expected to be raised');
148
        } catch (EntityNotFoundException $exception) {
149
        }
150
151
        self::assertFalse($proxy->isProxyInitialized());
152
    }
153
154
    /**
155
     * @group DDC-2432
@@ 157-184 (lines=28) @@
154
    /**
155
     * @group DDC-2432
156
     */
157
    public function testFailedProxyCloningDoesNotMarkTheProxyAsInitialized()
158
    {
159
        $classMetaData = $this->emMock->getClassMetadata(ECommerceFeature::class);
160
161
        $persister = $this
162
            ->getMockBuilder(BasicEntityPersister::class)
163
            ->setConstructorArgs([$this->emMock, $classMetaData])
164
            ->setMethods(['load'])
165
            ->getMock();
166
167
        $persister
168
            ->expects($this->atLeastOnce())
169
            ->method('load')
170
            ->will($this->returnValue(null));
171
172
        $this->uowMock->setEntityPersister(ECommerceFeature::class, $persister);
173
174
        /* @var $proxy GhostObjectInterface|ECommerceFeature */
175
        $proxy = $this->proxyFactory->getProxy(ECommerceFeature::class, ['id' => 42]);
176
177
        try {
178
            $cloned = clone $proxy;
179
            $this->fail('An exception was expected to be raised');
180
        } catch (EntityNotFoundException $exception) {
181
        }
182
183
        self::assertFalse($proxy->isProxyInitialized());
184
    }
185
186
    public function testProxyClonesParentFields()
187
    {