| Conditions | 1 |
| Paths | 1 |
| Total Lines | 50 |
| Code Lines | 34 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 177 | public function testSyncJiraException(): void |
||
| 178 | { |
||
| 179 | $dateTime = '2017-04-15T23:35:00+02:00'; |
||
| 180 | |||
| 181 | $timeEntries = [ |
||
| 182 | [ |
||
| 183 | 'description' => 'SLR-76 Soldier 76', |
||
| 184 | 'duration' => 76, |
||
| 185 | 'comment' => 'Soldier 76, reporting for duty', |
||
| 186 | 'at' => '2018-02-15' |
||
| 187 | ], |
||
| 188 | [ |
||
| 189 | 'description' => 'DVA-76 D-Va', |
||
| 190 | 'duration' => 42, |
||
| 191 | 'comment' => 'Nerf this!', |
||
| 192 | 'at' => '2018-02-15' |
||
| 193 | ], |
||
| 194 | ]; |
||
| 195 | |||
| 196 | $this->togglClientMock->shouldReceive('getTimeEntries') |
||
|
1 ignored issue
–
show
|
|||
| 197 | ->with(['start_date' => $dateTime]) |
||
| 198 | ->andReturn($timeEntries); |
||
| 199 | |||
| 200 | $workLogEntry = new WorkLogEntry(); |
||
| 201 | $workLogEntry->setIssueID('SLR-76'); |
||
| 202 | $workLogEntry->setSpentOn(new DateTimeImmutable($dateTime)); |
||
| 203 | $workLogEntry->setComment('SLR-76'); |
||
| 204 | $workLogEntry->setTimeSpent(76); |
||
| 205 | |||
| 206 | $this->hydratorMock->shouldReceive('hydrate')->andReturn($workLogEntry); |
||
|
2 ignored issues
–
show
|
|||
| 207 | |||
| 208 | $this->apiMock->shouldReceive('addWorkLogEntry')->with( |
||
| 209 | $workLogEntry->getIssueID(), |
||
|
1 ignored issue
–
show
|
|||
| 210 | $workLogEntry->getTimeSpent(), |
||
|
1 ignored issue
–
show
|
|||
| 211 | 'D-Va', |
||
| 212 | $workLogEntry->getComment(), |
||
| 213 | $dateTime |
||
| 214 | )->andThrow(\Exception::class, 'Nerf this!'); |
||
| 215 | |||
| 216 | $this->loggerMock |
||
| 217 | ->shouldReceive('info') |
||
| 218 | ->with("Found time entry for user story {$workLogEntry->getIssueID()}"); |
||
| 219 | |||
| 220 | $this->loggerMock |
||
| 221 | ->shouldReceive('error') |
||
| 222 | ->with("Could not add worklog entry: Nerf this!", \Mockery::any()); |
||
|
1 ignored issue
–
show
|
|||
| 223 | |||
| 224 | $this->loggerMock->shouldReceive('info')->with('All done for today, time to go home!'); |
||
| 225 | |||
| 226 | $this->service->sync($dateTime); |
||
| 227 | } |
||
| 235 | } |