ILIAS  release_8 Revision v8.23
InterruptiveTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for InterruptiveTest:
+ Collaboration diagram for InterruptiveTest:

Public Member Functions

 test_get_title ()
 
 test_get_message ()
 
 test_get_form_action ()
 
 test_get_affected_items ()
 
 test_with_form_action ()
 
 test_with_affected_items ()
 
 test_simple_rendering ()
 
 testLabels ()
 
- Public Member Functions inherited from ModalBase
 getUIFactory ()
 
 normalizeHTML (string $html)
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Protected Member Functions

 getInterruptiveItem ()
 
 getExpectedHTML ()
 
- Protected Member Functions inherited from ModalBase
 getModalFactory ()
 
 getButtonFactory ()
 
 getDummyComponent ()
 
- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Tests on implementation for the interruptive modal

Author
Stefan Wanzenried sw@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 31 of file InterruptiveTest.php.

Member Function Documentation

◆ getExpectedHTML()

InterruptiveTest::getExpectedHTML ( )
protected

Definition at line 89 of file InterruptiveTest.php.

References ILIAS\Repository\form().

Referenced by test_simple_rendering().

89  : string
90  {
91  $expected = <<<EOT
92 <div class="modal fade il-modal-interruptive" tabindex="-1" role="dialog" id="id_1">
93  <div class="modal-dialog" role="document">
94  <form action="myAction.php" method="POST">
95  <div class="modal-content">
96  <div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="cancel">
97  <span aria-hidden="true">&times;</span></button><span class="modal-title">Title</span>
98  </div>
99  <div class="modal-body">
100  <div class="alert alert-warning il-modal-interruptive-message" role="alert">Message</div>
101  </div>
102  <div class="modal-footer">
103  <input type="submit" class="btn btn-primary" value="delete" name="cmd[delete]">
104  <button class="btn btn-default" data-dismiss="modal">cancel</button>
105  </div>
106  </div>
107  </form>
108  </div>
109 </div>
110 EOT;
111  return $expected;
112  }
Title class.
Definition: Title.php:26
form( $class_path, string $cmd)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInterruptiveItem()

InterruptiveTest::getInterruptiveItem ( )
protected

Definition at line 84 of file InterruptiveTest.php.

Referenced by test_get_affected_items(), and test_with_affected_items().

+ Here is the caller graph for this function:

◆ test_get_affected_items()

InterruptiveTest::test_get_affected_items ( )

Definition at line 51 of file InterruptiveTest.php.

References getInterruptiveItem(), and ModalBase\getModalFactory().

51  : void
52  {
53  $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
54  $items = [$this->getInterruptiveItem(), $this->getInterruptiveItem()];
55  $interruptive = $interruptive->withAffectedItems($items);
56  $this->assertEquals($items, $interruptive->getAffectedItems());
57  }
getModalFactory()
Definition: ModalBase.php:51
+ Here is the call graph for this function:

◆ test_get_form_action()

InterruptiveTest::test_get_form_action ( )

Definition at line 45 of file InterruptiveTest.php.

References ModalBase\getModalFactory().

45  : void
46  {
47  $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
48  $this->assertEquals('myFormAction', $interruptive->getFormAction());
49  }
getModalFactory()
Definition: ModalBase.php:51
+ Here is the call graph for this function:

◆ test_get_message()

InterruptiveTest::test_get_message ( )

Definition at line 39 of file InterruptiveTest.php.

References ModalBase\getModalFactory().

39  : void
40  {
41  $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
42  $this->assertEquals('myMessage', $interruptive->getMessage());
43  }
getModalFactory()
Definition: ModalBase.php:51
+ Here is the call graph for this function:

◆ test_get_title()

InterruptiveTest::test_get_title ( )

Definition at line 33 of file InterruptiveTest.php.

References ModalBase\getModalFactory().

33  : void
34  {
35  $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
36  $this->assertEquals('myTitle', $interruptive->getTitle());
37  }
getModalFactory()
Definition: ModalBase.php:51
+ Here is the call graph for this function:

◆ test_simple_rendering()

InterruptiveTest::test_simple_rendering ( )

Definition at line 76 of file InterruptiveTest.php.

References ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), getExpectedHTML(), and ModalBase\getModalFactory().

76  : void
77  {
78  $interruptive = $this->getModalFactory()->interruptive('Title', 'Message', 'myAction.php');
79  $expected = $this->brutallyTrimHTML($this->getExpectedHTML());
80  $actual = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($interruptive));
81  $this->assertEquals($expected, $actual);
82  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
getModalFactory()
Definition: ModalBase.php:51
+ Here is the call graph for this function:

◆ test_with_affected_items()

InterruptiveTest::test_with_affected_items ( )

Definition at line 67 of file InterruptiveTest.php.

References getInterruptiveItem(), and ModalBase\getModalFactory().

67  : void
68  {
69  $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
70  $items = [$this->getInterruptiveItem(), $this->getInterruptiveItem()];
71  $interruptive2 = $interruptive->withAffectedItems($items);
72  $this->assertEquals(0, count($interruptive->getAffectedItems()));
73  $this->assertEquals($items, $interruptive2->getAffectedItems());
74  }
getModalFactory()
Definition: ModalBase.php:51
+ Here is the call graph for this function:

◆ test_with_form_action()

InterruptiveTest::test_with_form_action ( )

Definition at line 59 of file InterruptiveTest.php.

References ModalBase\getModalFactory().

59  : void
60  {
61  $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
62  $interruptive2 = $interruptive->withFormAction('myFormAction2');
63  $this->assertEquals('myFormAction', $interruptive->getFormAction());
64  $this->assertEquals('myFormAction2', $interruptive2->getFormAction());
65  }
getModalFactory()
Definition: ModalBase.php:51
+ Here is the call graph for this function:

◆ testLabels()

InterruptiveTest::testLabels ( )

Definition at line 115 of file InterruptiveTest.php.

115  : void
116  {
117  $action_label = 'actionlabel';
118  $cancel_label = 'cancellabel';
119  $interruptive = $this->getModalFactory()->interruptive('Title', 'Message', 'someaction')
120  ->withActionButtonLabel($action_label)
121  ->withCancelButtonLabel($cancel_label);
122 
123  $this->assertEquals(
124  $action_label,
125  $interruptive->getActionButtonLabel()
126  );
127  $this->assertEquals(
128  $cancel_label,
129  $interruptive->getCancelButtonLabel()
130  );
131  }
getModalFactory()
Definition: ModalBase.php:51

The documentation for this class was generated from the following file: