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

Test on standard form implementation. More...

+ Inheritance diagram for StandardFormTest:
+ Collaboration diagram for StandardFormTest:

Public Member Functions

 getUIFactory ()
 
 test_getPostURL ()
 
 test_render ()
 
 test_render_no_url ()
 
- 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

 buildFactory ()
 
 buildInputFactory ()
 
 buildButtonFactory ()
 
- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. More...
 

Detailed Description

Test on standard form implementation.

Definition at line 32 of file StandardFormTest.php.

Member Function Documentation

◆ buildButtonFactory()

StandardFormTest::buildButtonFactory ( )
protected

Definition at line 52 of file StandardFormTest.php.

Referenced by getUIFactory().

+ Here is the caller graph for this function:

◆ buildFactory()

StandardFormTest::buildFactory ( )
protected

Definition at line 34 of file StandardFormTest.php.

References buildInputFactory().

Referenced by test_getPostURL(), test_render(), and test_render_no_url().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildInputFactory()

StandardFormTest::buildInputFactory ( )
protected

Definition at line 40 of file StandardFormTest.php.

41 {
42 $df = new Data\Factory();
43 $language = $this->createMock(\ilLanguage::class);
45 new SignalGenerator(),
46 $df,
47 new \ILIAS\Refinery\Factory($df, $language),
48 $language
49 );
50 }
Class ChatMainBarProvider \MainMenu\Provider.

Referenced by buildFactory(), test_getPostURL(), test_render(), and test_render_no_url().

+ Here is the caller graph for this function:

◆ getUIFactory()

StandardFormTest::getUIFactory ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 58 of file StandardFormTest.php.

References buildButtonFactory().

+ Here is the call graph for this function:

◆ test_getPostURL()

StandardFormTest::test_getPostURL ( )

Definition at line 64 of file StandardFormTest.php.

65 {
66 $f = $this->buildFactory();
67 $if = $this->buildInputFactory();
68 $url = "MY_URL";
69 $form = $f->standard($url, [$if->text("label")]);
70 $this->assertEquals($url, $form->getPostURL());
71 }
$url

References Vendor\Package\$f, ILIAS\GlobalScreen\Provider\$if, $url, buildFactory(), and buildInputFactory().

+ Here is the call graph for this function:

◆ test_render()

StandardFormTest::test_render ( )

Definition at line 74 of file StandardFormTest.php.

75 {
76 $f = $this->buildFactory();
77 $if = $this->buildInputFactory();
78
79 $url = "MY_URL";
80 $form = $f->standard($url, [
81 $if->text("label", "byline"),
82 ]);
83
84 $r = $this->getDefaultRenderer();
85 $html = $r->render($form);
86
87 $expected = "<form role=\"form\" class=\"il-standard-form form-horizontal\" enctype=\"multipart/form-data\" action=\"MY_URL\" method=\"post\" novalidate=\"novalidate\"> <div class=\"il-standard-form-header clearfix\"> <div class=\"il-standard-form-cmd\"><button class=\"btn btn-default\" data-action=\"\">save</button></div> </div> <div class=\"form-group row\"> <label for=\"form_input_1\" class=\"control-label col-sm-3\">label</label> <div class=\"col-sm-9\"> <input type=\"text\" name=\"form_input_1\" class=\"form-control form-control-sm\" /> <div class=\"help-block\">byline</div> </div></div> <div class=\"il-standard-form-footer clearfix\"> <div class=\"il-standard-form-cmd\"><button class=\"btn btn-default\" data-action=\"\">save</button></div> </div></form>";
88 $this->assertHTMLEquals($expected, $html);
89 }
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268

References Vendor\Package\$f, ILIAS\GlobalScreen\Provider\$if, $url, ILIAS_UI_TestBase\assertHTMLEquals(), buildFactory(), buildInputFactory(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ test_render_no_url()

StandardFormTest::test_render_no_url ( )

Definition at line 91 of file StandardFormTest.php.

92 {
93 $f = $this->buildFactory();
94 $if = $this->buildInputFactory();
95
96 $url = "";
97 $form = $f->standard($url, [
98 $if->text("label", "byline"),
99 ]);
100
101 $r = $this->getDefaultRenderer();
102 $html = $r->render($form);
103
104 $expected = "<form role=\"form\" class=\"il-standard-form form-horizontal\" enctype=\"multipart/form-data\" method=\"post\" novalidate=\"novalidate\"> <div class=\"il-standard-form-header clearfix\"> <div class=\"il-standard-form-cmd\"><button class=\"btn btn-default\" data-action=\"\">save</button></div> </div> <div class=\"form-group row\"> <label for=\"form_input_1\" class=\"control-label col-sm-3\">label</label> <div class=\"col-sm-9\"> <input type=\"text\" name=\"form_input_1\" class=\"form-control form-control-sm\" /> <div class=\"help-block\">byline</div> </div></div> <div class=\"il-standard-form-footer clearfix\"> <div class=\"il-standard-form-cmd\"><button class=\"btn btn-default\" data-action=\"\">save</button></div> </div></form>";
105 $this->assertHTMLEquals($expected, $html);
106 }

References Vendor\Package\$f, ILIAS\GlobalScreen\Provider\$if, $url, ILIAS_UI_TestBase\assertHTMLEquals(), buildFactory(), buildInputFactory(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

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