ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 13 of file InterruptiveTest.php.

Member Function Documentation

◆ getExpectedHTML()

InterruptiveTest::getExpectedHTML ( )
protected

Definition at line 71 of file InterruptiveTest.php.

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

References data, and input.

Referenced by test_simple_rendering().

+ Here is the caller graph for this function:

◆ getInterruptiveItem()

InterruptiveTest::getInterruptiveItem ( )
protected

Definition at line 66 of file InterruptiveTest.php.

67 {
68 return new InterruptiveItemMock();
69 }

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

34 {
35 $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
36 $items = [$this->getInterruptiveItem(), $this->getInterruptiveItem()];
37 $interruptive = $interruptive->withAffectedItems($items);
38 $this->assertEquals($items, $interruptive->getAffectedItems());
39 }
getModalFactory()
Definition: ModalBase.php:41

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

+ Here is the call graph for this function:

◆ test_get_form_action()

InterruptiveTest::test_get_form_action ( )

Definition at line 27 of file InterruptiveTest.php.

28 {
29 $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
30 $this->assertEquals('myFormAction', $interruptive->getFormAction());
31 }

References ModalBase\getModalFactory().

+ Here is the call graph for this function:

◆ test_get_message()

InterruptiveTest::test_get_message ( )

Definition at line 21 of file InterruptiveTest.php.

22 {
23 $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
24 $this->assertEquals('myMessage', $interruptive->getMessage());
25 }

References ModalBase\getModalFactory().

+ Here is the call graph for this function:

◆ test_get_title()

InterruptiveTest::test_get_title ( )

Definition at line 15 of file InterruptiveTest.php.

16 {
17 $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
18 $this->assertEquals('myTitle', $interruptive->getTitle());
19 }

References ModalBase\getModalFactory().

+ Here is the call graph for this function:

◆ test_simple_rendering()

InterruptiveTest::test_simple_rendering ( )

Definition at line 58 of file InterruptiveTest.php.

59 {
60 $interruptive = $this->getModalFactory()->interruptive('Title', 'Message', 'myAction.php');
61 $expected = $this->normalizeHTML($this->getExpectedHTML());
62 $actual = $this->normalizeHTML($this->getDefaultRenderer()->render($interruptive));
63 $this->assertEquals($expected, $actual);
64 }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
normalizeHTML($html)
Definition: ModalBase.php:56

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

+ Here is the call graph for this function:

◆ test_with_affected_items()

InterruptiveTest::test_with_affected_items ( )

Definition at line 49 of file InterruptiveTest.php.

50 {
51 $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
52 $items = [$this->getInterruptiveItem(), $this->getInterruptiveItem()];
53 $interruptive2 = $interruptive->withAffectedItems($items);
54 $this->assertEquals(0, count($interruptive->getAffectedItems()));
55 $this->assertEquals($items, $interruptive2->getAffectedItems());
56 }

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

+ Here is the call graph for this function:

◆ test_with_form_action()

InterruptiveTest::test_with_form_action ( )

Definition at line 41 of file InterruptiveTest.php.

42 {
43 $interruptive = $this->getModalFactory()->interruptive('myTitle', 'myMessage', 'myFormAction');
44 $interruptive2 = $interruptive->withFormAction('myFormAction2');
45 $this->assertEquals('myFormAction', $interruptive->getFormAction());
46 $this->assertEquals('myFormAction2', $interruptive2->getFormAction());
47 }

References ModalBase\getModalFactory().

+ Here is the call graph for this function:

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