223 : void
224 {
225 $link_label = sha1('testRenderWithQrCodeTransferMechanism');
226
227
228 $svg_stub = $this->createStub(\
ILIAS\Data\SVG::class);
229 $svg_data_uri = 'data:image/svg+xml;base64,' . base64_encode($link_label);
230 $show_signal = $this->createStub(
C\Signal::class);
231
232
233 $this->to_svg_qr_code_mock
234 ->expects($this->once())
235 ->method('transform')
236 ->with($this->identicalTo($this->uri_stub))
237 ->willReturn($svg_stub);
238 $this->from_svg_mock
239 ->expects($this->once())
240 ->method('transform')
241 ->with($this->identicalTo($svg_stub))
242 ->willReturn($svg_data_uri);
243
244
245 $this->image_factory_mock
246 ->expects($this->once())
247 ->method('responsive')
248 ->with($svg_data_uri, $link_label);
249 $this->image_mock
250 ->expects($this->once())
251 ->method('withAction')
252 ->with($this->uri_stub_value)
253 ->willReturnSelf();
254
255
256 $this->modal_factory_mock
257 ->expects($this->once())
258 ->method('roundtrip')
259 ->with('use_qr_code', [$this->image_mock]);
260 $this->modal_mock
261 ->expects($this->once())
262 ->method('withCancelButtonLabel')
263 ->with('close')
264 ->willReturnSelf();
265 $this->modal_mock
266 ->expects($this->once())
267 ->method('withCloseWithKeyboard')
268 ->with(true)
269 ->willReturnSelf();
270 $this->modal_mock
271 ->expects($this->once())
272 ->method('getShowSignal')
273 ->willReturn($show_signal);
274
275
276 $this->button_factory_mock
277 ->expects($this->once())
278 ->method('standard')
279 ->with('show_qr_code', '');
280 $this->button_mock
281 ->expects($this->once())
282 ->method('withAriaLabel')
283 ->with('show_qr_code_aria')
284 ->willReturnSelf();
285 $this->button_mock
286 ->expects($this->once())
287 ->method('withSymbol')
288 ->with($this->identicalTo($this->glyph_stub))
289 ->willReturnSelf();
290 $this->button_mock
291 ->expects($this->once())
292 ->method('withOnClick')
293 ->with($this->identicalTo($show_signal))
294 ->willReturnSelf();
295
296 $link_transfer = $this->
getUIFactory()->transfer()->link(
298 $this->uri_stub,
299 $link_label,
300 );
301
302
303
304 $renderer = $this->getDefaultRenderer(
null, [$this->button_mock, $this->modal_mock]);
305
306 $expected = <<<HTML
307<div id="id_1" class="c-transfer c-transfer-link">
308 <label for="id_1_value">$link_label</label>
309 <div class="c-transfer__contents">
310 <input id="id_1_value" class="c-transfer__payload visible" type="url" value="$this->uri_stub_value" readonly="readonly">
311 $this->button_mock_html{$this->modal_mock_html}
312 </div>
313</div>
314HTML;
315
316 $actual =
$renderer->render($link_transfer);
317
318 $this->assertSame($this->brutallyTrimHTML($expected), $this->brutallyTrimHTML($actual));
319 }
@ QR_CODE
Transfer information by copying its contents to the computers clipboard.