|
@@ 95-114 (lines=20) @@
|
| 92 |
|
$this->assertCount($adventureCount, $this->adventureRepository->findAll()); |
| 93 |
|
} |
| 94 |
|
|
| 95 |
|
public function testDeleteAction() |
| 96 |
|
{ |
| 97 |
|
$client = $this->createUser(); |
| 98 |
|
|
| 99 |
|
$adventureCount = count($this->adventureRepository->findAll()); |
| 100 |
|
$adventureStepCount = count($this->adventureStepRepository->findAll()); |
| 101 |
|
$adventureComplRepoCount = count($this->adventureComplRepo->findAll()); |
| 102 |
|
$badgeCount = count($this->badgeRepository->findAll()); |
| 103 |
|
|
| 104 |
|
$adventure = $this->adventureRepository->findOneBy(['title' => 'Community']); |
| 105 |
|
$client->request('POST', 'admin/adventure/delete/' . $adventure->getId(), [ |
| 106 |
|
'_method' => 'DELETE', |
| 107 |
|
'form' => [] |
| 108 |
|
]); |
| 109 |
|
|
| 110 |
|
$this->assertCount($adventureCount -= 1, $this->adventureRepository->findAll(), 'Adventure is removed'); |
| 111 |
|
$this->assertCount($adventureStepCount -= 2, $this->adventureStepRepository->findAll(), 'Steps of adventure are removed'); |
| 112 |
|
$this->assertCount($adventureComplRepoCount -= 1, $this->adventureComplRepo->findAll(), 'Completions steps of adventure are removed'); |
| 113 |
|
$this->assertCount($badgeCount, $this->badgeRepository->findAll(), 'Badge are not removed when an adventure is removed'); |
| 114 |
|
} |
| 115 |
|
|
| 116 |
|
public function testUpdateAnAdventureToDeleteAStep() |
| 117 |
|
{ |
|
@@ 150-169 (lines=20) @@
|
| 147 |
|
$this->assertCount($adventureCompletionCount -= 1, $this->adventureComplRepo->findAll(), 'Adventure Completion linked to deleted step is removed'); |
| 148 |
|
} |
| 149 |
|
|
| 150 |
|
public function testDeleteWhenStepsAreLinkedToBadges() |
| 151 |
|
{ |
| 152 |
|
$client = $this->createUser(); |
| 153 |
|
|
| 154 |
|
$adventureCount = count($this->adventureRepository->findAll()); |
| 155 |
|
$adventureStepCount = count($this->adventureStepRepository->findAll()); |
| 156 |
|
$adventureComplRepoCount = count($this->adventureComplRepo->findAll()); |
| 157 |
|
$badgeCount = count($this->badgeRepository->findAll()); |
| 158 |
|
|
| 159 |
|
$adventure = $this->adventureRepository->findOneBy(['title' => 'ASS']); |
| 160 |
|
$client->request('POST', 'admin/adventure/delete/' . $adventure->getId(), [ |
| 161 |
|
'_method' => 'DELETE', |
| 162 |
|
'form' => [] |
| 163 |
|
]); |
| 164 |
|
|
| 165 |
|
$this->assertCount($adventureCount -= 1, $this->adventureRepository->findAll(), 'Adventure is removed'); |
| 166 |
|
$this->assertCount($adventureStepCount -= 4, $this->adventureStepRepository->findAll(), 'Steps of adventure are removed'); |
| 167 |
|
$this->assertCount($adventureComplRepoCount -= 2, $this->adventureComplRepo->findAll(), 'Completions steps of adventure are removed'); |
| 168 |
|
$this->assertCount($badgeCount, $this->badgeRepository->findAll(), 'Badge are not removed when an adventure is removed'); |
| 169 |
|
} |
| 170 |
|
} |
| 171 |
|
|