@@ 13-26 (lines=14) @@ | ||
10 | ||
11 | class CloneListenerTest extends TestCase |
|
12 | { |
|
13 | public function testOnDeepCloneAndSaveWithAbstractEntity() |
|
14 | { |
|
15 | $listener = new CloneListener(); |
|
16 | ||
17 | /** @var AbstractEntity $entityMock */ |
|
18 | $entityMock = $this->getMockForAbstractClass(AbstractEntity::class); |
|
19 | $entityMock->setId(747); |
|
20 | ||
21 | $event = $this->createMock(DeepCloneAndSaveEvent::class); |
|
22 | $event->expects($this->any())->method('getClonedEntity')->willReturn($entityMock); |
|
23 | ||
24 | $listener->onDeepCloneAndSave($event); |
|
25 | $this->assertNull($entityMock->getId()); |
|
26 | } |
|
27 | ||
28 | public function testOnDeepCloneAndSaveWithDeepCloneInterface() |
|
29 | { |
|
@@ 28-39 (lines=12) @@ | ||
25 | $this->assertNull($entityMock->getId()); |
|
26 | } |
|
27 | ||
28 | public function testOnDeepCloneAndSaveWithDeepCloneInterface() |
|
29 | { |
|
30 | $listener = new CloneListener(); |
|
31 | ||
32 | $deepCloneInterfaceMock = $this->createMock(DeepCloneInterface::class); |
|
33 | $deepCloneInterfaceMock->expects($this->once())->method('deepClone'); |
|
34 | ||
35 | $event = $this->createMock(DeepCloneAndSaveEvent::class); |
|
36 | $event->expects($this->any())->method('getClonedEntity')->willReturn($deepCloneInterfaceMock); |
|
37 | ||
38 | $listener->onDeepCloneAndSave($event); |
|
39 | } |
|
40 | } |
|
41 |