ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ModalTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 
23 require_once(__DIR__ . '/ModalBase.php');
24 
30 class ModalTest extends ModalBase
31 {
32  public function test_with_close_with_keyboard(): void
33  {
34  $modal = $this->getModal();
35  $this->assertEquals(true, $modal->getCloseWithKeyboard());
36  $modal = $modal->withCloseWithKeyboard(false);
37  $this->assertEquals(false, $modal->getCloseWithKeyboard());
38  }
39 
40  public function test_with_async_rendered_url(): void
41  {
42  $modal = $this->getModal()->withAsyncRenderUrl('/fake/async/url');
43  $this->assertEquals('/fake/async/url', $modal->getAsyncRenderUrl());
44  }
45 
46  public function test_get_signals(): void
47  {
48  $modal = $this->getModal();
49  $show = $modal->getShowSignal();
50  $close = $modal->getCloseSignal();
51  $this->assertEquals('signal_1', "$show");
52  $this->assertEquals('signal_2', "$close");
53  $modal2 = $modal->withAsyncRenderUrl('blub');
54  $show = $modal2->getShowSignal();
55  $close = $modal2->getCloseSignal();
56  $this->assertEquals('signal_1', "$show");
57  $this->assertEquals('signal_2', "$close");
58  }
59 
60  public function test_with_reset_signals(): void
61  {
62  $modal = $this->getModal();
63  $modal2 = $modal->withResetSignals();
64  $show = $modal2->getShowSignal();
65  $close = $modal2->getCloseSignal();
66  $this->assertEquals('signal_3', "$show");
67  $this->assertEquals('signal_4', "$close");
68  }
69 
70  protected function getModal(): ModalMock
71  {
72  return new ModalMock(new IncrementalSignalGenerator());
73  }
74 }
75 
76 class ModalMock extends Modal
77 {
78  public function getCanonicalName(): string
79  {
80  return "Modal Mock";
81  }
82 }
test_with_reset_signals()
Definition: ModalTest.php:60
Tests on abstract base class for modals.
Definition: ModalTest.php:30
test_with_close_with_keyboard()
Definition: ModalTest.php:32
getCanonicalName()
Definition: ModalTest.php:78
test_get_signals()
Definition: ModalTest.php:46
Base class for modal tests.
Definition: ModalBase.php:34
test_with_async_rendered_url()
Definition: ModalTest.php:40
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...