ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
RoundTripTest Class Reference

Tests on implementation for the roundtrip modal. More...

+ Inheritance diagram for RoundTripTest:
+ Collaboration diagram for RoundTripTest:

Public Member Functions

 test_get_title ()
 
 test_get_content ()
 
 test_get_action_buttons ()
 
 test_with_action_buttons ()
 
 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 ()
 
 getRefinery ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Protected Member Functions

 getExpectedHTML ()
 
- Protected Member Functions inherited from ModalBase
 getModalFactory ()
 
 getButtonFactory ()
 
 getDummyComponent ()
 
- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. More...
 

Detailed Description

Tests on implementation for the roundtrip modal.

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

Definition at line 10 of file RoundTripTest.php.

Member Function Documentation

◆ getExpectedHTML()

RoundTripTest::getExpectedHTML ( )
protected

Definition at line 66 of file RoundTripTest.php.

67 {
68 $expected = <<<EOT
69<div class="modal fade il-modal-roundtrip" tabindex="-1" role="dialog" id="id_1"><div class="modal-dialog" role="document" data-replace-marker="component"><div class="modal-content">
70 <div class="modal-header">
71 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"></span></button><h4 class="modal-title">Title</h4>
72 </div>
73 <div class="modal-body">Content</div>
74 <div class="modal-footer">
75 <button class="btn btn-default btn-primary" data-action="">Action 1</button><button class="btn btn-default" data-action="">Action 2</button><a class="btn btn-default" data-dismiss="modal" aria-label="Close">cancel</a>
76 </div>
77 </div></div></div>
78EOT;
79 return $expected;
80 }
Title class.
Definition: Title.php:37

Referenced by test_simple_rendering().

+ Here is the caller graph for this function:

◆ test_get_action_buttons()

RoundTripTest::test_get_action_buttons ( )

Definition at line 28 of file RoundTripTest.php.

29 {
30 $roundtrip = $this->getModalFactory()->roundtrip('myTitle', $this->getDummyComponent());
31 $action_buttons = [
32 $this->getButtonFactory()->primary('Action 1', ''),
33 $this->getButtonFactory()->standard('Action 2', ''),
34 ];
35 $roundtrip = $roundtrip->withActionButtons($action_buttons);
36 $this->assertEquals($action_buttons, $roundtrip->getActionButtons());
37 }
getButtonFactory()
Definition: ModalBase.php:36
getModalFactory()
Definition: ModalBase.php:31
getDummyComponent()
Definition: ModalBase.php:41

References ModalBase\getButtonFactory(), ModalBase\getDummyComponent(), and ModalBase\getModalFactory().

+ Here is the call graph for this function:

◆ test_get_content()

RoundTripTest::test_get_content ( )

Definition at line 18 of file RoundTripTest.php.

19 {
20 $content = $this->getDummyComponent();
21 $roundtrip = $this->getModalFactory()->roundtrip('myTitle', $content);
22 $this->assertEquals([$content], $roundtrip->getContent());
23 $content = [$this->getDummyComponent(), $this->getDummyComponent()];
24 $roundtrip = $this->getModalFactory()->roundtrip('myTitle', $content);
25 $this->assertEquals($content, $roundtrip->getContent());
26 }

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

+ Here is the call graph for this function:

◆ test_get_title()

RoundTripTest::test_get_title ( )

Definition at line 12 of file RoundTripTest.php.

13 {
14 $roundtrip = $this->getModalFactory()->roundtrip('myTitle', $this->getDummyComponent());
15 $this->assertEquals('myTitle', $roundtrip->getTitle());
16 }

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

+ Here is the call graph for this function:

◆ test_simple_rendering()

RoundTripTest::test_simple_rendering ( )

Definition at line 53 of file RoundTripTest.php.

54 {
55 $roundtrip = $this->getModalFactory()->roundtrip('Title', $this->getUIFactory()->legacy('Content'))
56 ->withActionButtons([
57 $this->getButtonFactory()->primary('Action 1', ''),
58 $this->getButtonFactory()->standard('Action 2', ''),
59 ]);
60 $expected = $this->normalizeHTML($this->getExpectedHTML());
61 $actual = $this->normalizeHTML($this->getDefaultRenderer()->render($roundtrip));
62 $this->assertHTMLEquals($expected, $actual);
63 }
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
normalizeHTML($html)
Definition: ModalBase.php:46
getUIFactory()
Definition: ModalBase.php:15
legacy()
Definition: legacy.php:3
standard()
This is an example, of how the Notification Slate is generated by assigning Notification Items to it.
Definition: standard.php:11

References ILIAS_UI_TestBase\assertHTMLEquals(), ModalBase\getButtonFactory(), ILIAS_UI_TestBase\getDefaultRenderer(), getExpectedHTML(), ModalBase\getModalFactory(), ModalBase\getUIFactory(), legacy(), ModalBase\normalizeHTML(), and standard().

+ Here is the call graph for this function:

◆ test_with_action_buttons()

RoundTripTest::test_with_action_buttons ( )

Definition at line 39 of file RoundTripTest.php.

40 {
41 $roundtrip = $this->getModalFactory()->roundtrip('myTitle', $this->getDummyComponent());
42 $action_buttons = [
43 $this->getButtonFactory()->primary('Action 1', ''),
44 $this->getButtonFactory()->standard('Action 2', ''),
45 ];
46 $roundtrip2 = $roundtrip->withActionButtons($action_buttons);
47 $this->assertEquals(0, count($roundtrip->getActionButtons()));
48 $this->assertEquals(2, count($roundtrip2->getActionButtons()));
49 $this->assertEquals($action_buttons, $roundtrip2->getActionButtons());
50 }

References ModalBase\getButtonFactory(), ModalBase\getDummyComponent(), and ModalBase\getModalFactory().

+ Here is the call graph for this function:

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