Conditions | 1 |
Paths | 1 |
Total Lines | 50 |
Code Lines | 33 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
65 | public function testSync(): void |
||
66 | { |
||
67 | $dateTime = '2017-04-15T23:35:00+02:00'; |
||
68 | |||
69 | $timeEntries = [ |
||
70 | [ |
||
71 | 'description' => 'SLR-76 Soldier 76', |
||
72 | 'duration' => 76, |
||
73 | 'comment' => 'Soldier 76, reporting for duty', |
||
74 | 'at' => '2018-02-15' |
||
75 | ], |
||
76 | [ |
||
77 | 'description' => 'DVA-76 D-Va', |
||
78 | 'duration' => 42, |
||
79 | 'comment' => 'Nerf this!', |
||
80 | 'at' => '2018-02-15' |
||
81 | ], |
||
82 | ]; |
||
83 | |||
84 | $this->togglClientMock->shouldReceive('getTimeEntries') |
||
1 ignored issue
–
show
|
|||
85 | ->with(['start_date' => $dateTime]) |
||
86 | ->andReturn($timeEntries); |
||
87 | |||
88 | $workLogEntry = new WorkLogEntry(); |
||
89 | $workLogEntry->setIssueID('SLR-76'); |
||
90 | $workLogEntry->setSpentOn(new DateTimeImmutable($dateTime)); |
||
91 | $workLogEntry->setComment('SLR-76'); |
||
92 | $workLogEntry->setTimeSpent(76); |
||
93 | |||
94 | $this->hydratorMock->shouldReceive('hydrate')->andReturn($workLogEntry); |
||
2 ignored issues
–
show
|
|||
95 | |||
96 | $this->apiMock->shouldReceive('addWorkLogEntry')->with( |
||
97 | $workLogEntry->getIssueID(), |
||
1 ignored issue
–
show
|
|||
98 | $workLogEntry->getTimeSpent(), |
||
1 ignored issue
–
show
|
|||
99 | 'D-Va', |
||
100 | $workLogEntry->getComment(), |
||
101 | $dateTime |
||
102 | ); |
||
103 | |||
104 | $this->loggerMock |
||
105 | ->shouldReceive('info') |
||
106 | ->with("Found time entry for user story {$workLogEntry->getIssueID()}"); |
||
107 | |||
108 | $this->loggerMock |
||
109 | ->shouldReceive('info') |
||
110 | ->with("Added worklog entry for issue {$workLogEntry->getIssueID()}"); |
||
111 | |||
112 | $this->loggerMock->shouldReceive('info')->with('All done for today, time to go home!'); |
||
113 | |||
114 | $this->service->sync($dateTime); |
||
115 | } |
||
235 | } |