174 : void
175 {
178
179 $lastResetDate = $this->getMockBuilder(ilDate::class)
180 ->disableOriginalConstructor()
181 ->getMock();
182
183 $date = new DateTime();
184
185 $lastResetDate->setDate($date->getTimestamp(),
IL_CAL_UNIX);
186
187 $lastResetDate
188 ->method('get')
189 ->willReturn([
190 'seconds' => (int) $date->format('s'),
191 'minutes' => (int) $date->format('i'),
192 'hours' => (int) $date->format('G'),
193 'mday' => (int) $date->format('j'),
194 'wday' => (int) $date->format('w'),
195 'mon' => (int) $date->format('n'),
196 'year' => (int) $date->format('Y'),
197 'yday' => (int) $date->format('z'),
198 'weekday' => $date->format('l'),
199 'month' => $date->format('F'),
200 'isoday' => (int) $date->format('N')
201 ]);
202
203 $lastResetDate
204 ->method('isNull')
205 ->willReturn(true);
206
207 $this->tos
208 ->method('getLastResetDate')
209 ->willReturn($lastResetDate);
210
212 ->expects($this->once())
213 ->method('getCmd')
214 ->willReturn('getResetMessageBoxHtml');
215
217 ->expects($this->once())
218 ->method('getLinkTarget')
219 ->with($this->isInstanceOf(ilTermsOfServiceDocumentGUI::class), 'confirmReset')
220 ->willReturn('confirmReset');
221
222 $this->rbacsystem
223 ->method('checkAccess')
224 ->willReturn(true);
225
227 $button = $this->getMockBuilder(Standard::class)->getMock();
228
229 $buttonFactory
230 ->expects($this->once())
231 ->method('standard')
232 ->with($this->isType('string'), $this->equalTo('confirmReset'))
233 ->willReturn($button);
234
235 $this->uiFactory
236 ->expects($this->once())
237 ->method('button')
238 ->willReturn($buttonFactory);
239
241 $info = $this->getMockBuilder(MessageBox::class)->getMock();
242
243 $messageBoxFactory
244 ->expects($this->once())
245 ->method('info')
246 ->with($this->stringContains('Some date:'))
247 ->willReturn($info);
248
249 $info
250 ->expects($this->once())
251 ->method('withButtons')
252 ->with($this->countOf(1));
253
254 $this->uiFactory
255 ->expects($this->once())
256 ->method('messageBox')
257 ->willReturn($messageBoxFactory);
258
260 ->expects($this->never())
261 ->method('raiseError');
262
263 $this->uiRenderer
264 ->expects($this->atLeast(1))
265 ->method('render')
266 ->willReturn('');
267
269 ->expects($this->exactly(2))
270 ->method('txt')
271 ->willReturnOnConsecutiveCalls(
272 'Some date: %s',
273 'Some button text'
274 );
275
277 $this->tos,
278 $this->criterionTypeFactory,
279 $this->tpl,
283 $this->rbacsystem,
285 $this->log,
287 $this->httpState,
288 $this->uiFactory,
289 $this->uiRenderer,
290 $this->fileSystems,
291 $this->fileUpload,
292 $this->tableDataProviderFactory,
293 $this->documentPurifier,
295 );
296
297 $gui->executeCommand();
298 }
setGlobalVariable(string $name, $value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...