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

◆ buildFactory()

StandardFormTest::buildFactory ( )
protected

Definition at line 36 of file StandardFormTest.php.

◆ 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.
Builds data types.
Definition: Factory.php:14

◆ getUIFactory()

StandardFormTest::getUIFactory ( )

Definition at line 59 of file StandardFormTest.php.

◆ test_getPostURL()

StandardFormTest::test_getPostURL ( )

Definition at line 65 of file StandardFormTest.php.

References $f, $form, and $url.

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  }
if(isset($_POST['submit'])) $form
$url

◆ test_render()

StandardFormTest::test_render ( )

Definition at line 75 of file StandardFormTest.php.

References $f, $form, $html, $r, and $url.

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  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$r
Definition: example_031.php:79
if(isset($_POST['submit'])) $form
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
$url
$html
Definition: example_001.php:87

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