ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ()
 
- 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

 buildFactory ()
 
 buildInputFactory ()
 
 buildButtonFactory ()
 

Detailed Description

Test on standard form implementation.

Definition at line 34 of file StandardFormTest.php.

Member Function Documentation

◆ buildButtonFactory()

StandardFormTest::buildButtonFactory ( )
protected

Definition at line 53 of file StandardFormTest.php.

Referenced by getUIFactory().

+ Here is the caller graph for this function:

◆ buildFactory()

StandardFormTest::buildFactory ( )
protected

Definition at line 36 of file StandardFormTest.php.

References buildInputFactory().

Referenced by test_getPostURL(), and test_render().

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

◆ buildInputFactory()

StandardFormTest::buildInputFactory ( )
protected

Definition at line 42 of file StandardFormTest.php.

43 {
44 $df = new Data\Factory();
46 new SignalGenerator(),
47 $df,
48 new Validation\Factory($df, $this->createMock(\ilLanguage::class)),
50 );
51 }
A transformation is a function from one datatype to another.

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

+ Here is the caller graph for this function:

◆ getUIFactory()

StandardFormTest::getUIFactory ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 59 of file StandardFormTest.php.

References buildButtonFactory().

+ Here is the call graph for this function:

◆ test_getPostURL()

StandardFormTest::test_getPostURL ( )

Definition at line 65 of file StandardFormTest.php.

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

References $f, $form, $url, buildFactory(), and buildInputFactory().

+ Here is the call graph for this function:

◆ test_render()

StandardFormTest::test_render ( )

Definition at line 75 of file StandardFormTest.php.

76 {
77 $f = $this->buildFactory();
78 $if = $this->buildInputFactory();
79
80 $url = "MY_URL";
81 $form = $f->standard($url, [
82 $if->text("label", "byline"),
83 ]);
84
85 $r = $this->getDefaultRenderer();
86 $html = $r->render($form);
87
88 $expected = "<form role=\"form\" class=\"il-standard-form form-horizontal\" enctype=\"multipart/formdata\" 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=\"#\" id=\"id_1\">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=\"#\" id=\"id_2\">save</button></div> </div></form>";
89 $this->assertHTMLEquals($expected, $html);
90 }
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79

References $f, $form, $html, $r, $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: