ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
InterruptiveTest Class Reference

Tests on implementation for the interruptive modal. 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 ()
 
- Public Member Functions inherited from ModalBase
 getUIFactory ()
 
 normalizeHTML ($html)
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Protected Member Functions

 getInterruptiveItem ()
 
 getExpectedHTML ()
 
- Protected Member Functions inherited from ModalBase
 getModalFactory ()
 
 getButtonFactory ()
 
 getDummyComponent ()
 

Detailed Description

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 12 of file InterruptiveTest.php.

Member Function Documentation

◆ getExpectedHTML()

InterruptiveTest::getExpectedHTML ( )
protected

Definition at line 70 of file InterruptiveTest.php.

Referenced by test_simple_rendering().

71  {
72  $expected = <<<EOT
73 <div class="modal fade il-modal-interruptive" tabindex="-1" role="dialog" id="id_1">
74  <div class="modal-dialog" role="document">
75  <form action="myAction.php" method="POST">
76  <div class="modal-content">
77  <div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close">
78  <span aria-hidden="true"></span></button><h4 class="modal-title">Title</h4>
79  </div>
80  <div class="modal-body">
81  <div class="alert alert-warning il-modal-interruptive-message" role="alert">Message</div>
82  </div>
83  <div class="modal-footer">
84  <input type="submit" class="btn btn-primary" value="delete">
85  <a class="btn btn-default" data-dismiss="modal" aria-label="Close">cancel</a>
86  </div>
87  </div>
88  </form>
89  </div>
90 </div>
91 EOT;
92  return $expected;
93  }
Add some data
Title class.
Definition: Title.php:36
+ Here is the caller graph for this function:

◆ getInterruptiveItem()

InterruptiveTest::getInterruptiveItem ( )
protected

Definition at line 65 of file InterruptiveTest.php.

Referenced by test_get_affected_items(), and test_with_affected_items().

66  {
67  return new InterruptiveItemMock();
68  }
+ Here is the caller graph for this function:

◆ test_get_affected_items()

InterruptiveTest::test_get_affected_items ( )

Definition at line 32 of file InterruptiveTest.php.

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

33  {
34  $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
35  $items = [$this->getInterruptiveItem(), $this->getInterruptiveItem()];
36  $interruptive = $interruptive->withAffectedItems($items);
37  $this->assertEquals($items, $interruptive->getAffectedItems());
38  }
getModalFactory()
Definition: ModalBase.php:19
+ Here is the call graph for this function:

◆ test_get_form_action()

InterruptiveTest::test_get_form_action ( )

Definition at line 26 of file InterruptiveTest.php.

References ModalBase\getModalFactory().

27  {
28  $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
29  $this->assertEquals('myFormAction', $interruptive->getFormAction());
30  }
getModalFactory()
Definition: ModalBase.php:19
+ Here is the call graph for this function:

◆ test_get_message()

InterruptiveTest::test_get_message ( )

Definition at line 20 of file InterruptiveTest.php.

References ModalBase\getModalFactory().

21  {
22  $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
23  $this->assertEquals('myMessage', $interruptive->getMessage());
24  }
getModalFactory()
Definition: ModalBase.php:19
+ Here is the call graph for this function:

◆ test_get_title()

InterruptiveTest::test_get_title ( )

Definition at line 14 of file InterruptiveTest.php.

References ModalBase\getModalFactory().

15  {
16  $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
17  $this->assertEquals('myTitle', $interruptive->getTitle());
18  }
getModalFactory()
Definition: ModalBase.php:19
+ Here is the call graph for this function:

◆ test_simple_rendering()

InterruptiveTest::test_simple_rendering ( )

Definition at line 57 of file InterruptiveTest.php.

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

58  {
59  $interruptive = $this->getModalFactory()->interruptive('Title', 'Message', 'myAction.php');
60  $expected = $this->normalizeHTML($this->getExpectedHTML());
61  $actual = $this->normalizeHTML($this->getDefaultRenderer()->render($interruptive));
62  $this->assertEquals($expected, $actual);
63  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
normalizeHTML($html)
Definition: ModalBase.php:34
getModalFactory()
Definition: ModalBase.php:19
+ Here is the call graph for this function:

◆ test_with_affected_items()

InterruptiveTest::test_with_affected_items ( )

Definition at line 48 of file InterruptiveTest.php.

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

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

◆ test_with_form_action()

InterruptiveTest::test_with_form_action ( )

Definition at line 40 of file InterruptiveTest.php.

References ModalBase\getModalFactory().

41  {
42  $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
43  $interruptive2 = $interruptive->withFormAction('myFormAction2');
44  $this->assertEquals('myFormAction', $interruptive->getFormAction());
45  $this->assertEquals('myFormAction2', $interruptive2->getFormAction());
46  }
getModalFactory()
Definition: ModalBase.php:19
+ Here is the call graph for this function:

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