@@ 213-262 (lines=50) @@ | ||
210 | $this->assertFalse($parentMetadata->isMappedSuperclass); |
|
211 | } |
|
212 | ||
213 | public function testLoadClassMetadataWithResourceAndParentClassesWithoutClassMetadata() |
|
214 | { |
|
215 | $event = $this->createLoadClassMetadataEventArgsMock(); |
|
216 | $event |
|
217 | ->expects($this->once()) |
|
218 | ->method('getClassMetadata') |
|
219 | ->will($this->returnValue($classMetadata = $this->createClassMetadataMock())); |
|
220 | ||
221 | $classMetadata |
|
222 | ->expects($this->once()) |
|
223 | ->method('getName') |
|
224 | ->will($this->returnValue($model = 'model')); |
|
225 | ||
226 | $this->serviceRegistry |
|
227 | ->expects($this->once()) |
|
228 | ->method('getIterator') |
|
229 | ->will($this->returnValue(new \ArrayIterator([$resource = $this->createResourceMock()]))); |
|
230 | ||
231 | $resource |
|
232 | ->expects($this->once()) |
|
233 | ->method('getModel') |
|
234 | ->will($this->returnValue($model)); |
|
235 | ||
236 | $classMetadata->parentClasses = [$parentClass = 'ParentClass']; |
|
237 | ||
238 | $event |
|
239 | ->expects($this->once()) |
|
240 | ->method('getObjectManager') |
|
241 | ->will($this->returnValue($objectManager = $this->createObjectManagerMock())); |
|
242 | ||
243 | $objectManager |
|
244 | ->expects($this->once()) |
|
245 | ->method('getClassMetadata') |
|
246 | ->with($this->identicalTo($parentClass)) |
|
247 | ->will($this->throwException($this->createMappingExceptionMock())); |
|
248 | ||
249 | $resource |
|
250 | ->expects($this->once()) |
|
251 | ->method('getRepository') |
|
252 | ->will($this->returnValue($repository = 'repository')); |
|
253 | ||
254 | $classMetadata |
|
255 | ->expects($this->once()) |
|
256 | ->method('setCustomRepositoryClass') |
|
257 | ->with($this->identicalTo($repository)); |
|
258 | ||
259 | $this->resourceSubscriber->loadClassMetadata($event); |
|
260 | ||
261 | $this->assertFalse($classMetadata->isMappedSuperclass); |
|
262 | } |
|
263 | ||
264 | public function testLoadClassMetadataWithoutResource() |
|
265 | { |
@@ 209-258 (lines=50) @@ | ||
206 | $this->assertFalse($parentMetadata->isMappedSuperclass); |
|
207 | } |
|
208 | ||
209 | public function testLoadClassMetadataWithResourceAndParentClassesWithoutClassMetadata() |
|
210 | { |
|
211 | $event = $this->createLoadClassMetadataEventArgsMock(); |
|
212 | $event |
|
213 | ->expects($this->once()) |
|
214 | ->method('getClassMetadata') |
|
215 | ->will($this->returnValue($classMetadata = $this->createClassMetadataMock())); |
|
216 | ||
217 | $classMetadata |
|
218 | ->expects($this->once()) |
|
219 | ->method('getName') |
|
220 | ->will($this->returnValue($model = 'model')); |
|
221 | ||
222 | $this->serviceRegistry |
|
223 | ->expects($this->once()) |
|
224 | ->method('getIterator') |
|
225 | ->will($this->returnValue(new \ArrayIterator([$resource = $this->createResourceMock()]))); |
|
226 | ||
227 | $resource |
|
228 | ->expects($this->once()) |
|
229 | ->method('getModel') |
|
230 | ->will($this->returnValue($model)); |
|
231 | ||
232 | $classMetadata->parentClasses = [$parentClass = 'ParentClass']; |
|
233 | ||
234 | $event |
|
235 | ->expects($this->once()) |
|
236 | ->method('getObjectManager') |
|
237 | ->will($this->returnValue($objectManager = $this->createObjectManagerMock())); |
|
238 | ||
239 | $objectManager |
|
240 | ->expects($this->once()) |
|
241 | ->method('getClassMetadata') |
|
242 | ->with($this->identicalTo($parentClass)) |
|
243 | ->will($this->throwException($this->createMappingExceptionMock())); |
|
244 | ||
245 | $resource |
|
246 | ->expects($this->once()) |
|
247 | ->method('getRepository') |
|
248 | ->will($this->returnValue($repository = 'repository')); |
|
249 | ||
250 | $classMetadata |
|
251 | ->expects($this->once()) |
|
252 | ->method('setCustomRepositoryClass') |
|
253 | ->with($this->identicalTo($repository)); |
|
254 | ||
255 | $this->resourceSubscriber->loadClassMetadata($event); |
|
256 | ||
257 | $this->assertFalse($classMetadata->isMappedSuperclass); |
|
258 | } |
|
259 | ||
260 | public function testLoadClassMetadataWithoutResource() |
|
261 | { |