ILIAS  release_7 Revision v7.30-3-g800a261c036
SectionInputTest Class Reference
+ Inheritance diagram for SectionInputTest:
+ Collaboration diagram for SectionInputTest:

Public Member Functions

 getFieldFactory ()
 
 testSectionRendering ()
 
 testSectionRenderingWithError ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Additional Inherited Members

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

Detailed Description

Definition at line 11 of file SectionInputTest.php.

Member Function Documentation

◆ getFieldFactory()

SectionInputTest::getFieldFactory ( )

Definition at line 13 of file SectionInputTest.php.

14 {
15 $factory = new Field\Factory(
17 new Data\Factory(),
18 $this->getRefinery(),
19 $this->getLanguage()
20 );
21 return $factory;
22 }
Builds data types.
Definition: Factory.php:20
$factory
Definition: metadata.php:58

References $factory, ILIAS_UI_TestBase\getLanguage(), and ILIAS_UI_TestBase\getRefinery().

Referenced by testSectionRendering(), and testSectionRenderingWithError().

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

◆ testSectionRendering()

SectionInputTest::testSectionRendering ( )

Definition at line 24 of file SectionInputTest.php.

25 {
26 $f = $this->getFieldFactory();
27 $r = $this->getDefaultRenderer();
28 $inputs = [
29 $f->text("input1", "in 1"),
30 $f->text("input2", "in 2")
31 ];
32 $label = 'section label';
33 $byline = 'section byline';
34 $section = $f->section($inputs, $label, $byline);
35 $actual = $this->brutallyTrimHTML($r->render($section));
36 $expected = <<<EOT
37 <div class="il-section-input">
38 <div class="il-section-input-header">
39 <h2>section label</h2>
40 <div class="il-section-input-header-byline">section byline</div>
41 </div>
42 <div class="form-group row">
43 <label for="id_1" class="control-label col-sm-3">input1</label>
44 <div class="col-sm-9">
45 <input id="id_1" type="text" name="" class="form-control form-control-sm" />
46 <div class="help-block">in 1</div>
47 </div>
48 </div>
49 <div class="form-group row">
50 <label for="id_2" class="control-label col-sm-3">input2</label>
51 <div class="col-sm-9">
52 <input id="id_2" type="text" name="" class="form-control form-control-sm" />
53 <div class="help-block">in 2</div>
54 </div>
55 </div>
56 </div>
57EOT;
58 $expected = $this->brutallyTrimHTML($expected);
59 $this->assertEquals($expected, $actual);
60 }
$section
Definition: Utf8Test.php:83
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
Definition: Base.php:311
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Definition: Base.php:392

References Vendor\Package\$f, $section, ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFieldFactory().

+ Here is the call graph for this function:

◆ testSectionRenderingWithError()

SectionInputTest::testSectionRenderingWithError ( )

Definition at line 62 of file SectionInputTest.php.

63 {
64 $f = $this->getFieldFactory();
65 $r = $this->getDefaultRenderer();
66 $inputs = [
67 $f->text("input1", "in 1")
68 ];
69 $label = 'section label';
70 $byline = 'section byline';
71 $section = $f->section($inputs, $label, $byline);
72 $actual = $this->brutallyTrimHTML($r->render($section->withError("Some Error")));
73 $expected = <<<EOT
74 <div class="il-section-input">
75 <div class="il-section-input-header">
76 <h2>section label</h2>
77 <div class="il-section-input-header-byline">section byline</div>
78 </div>
79 <div class="help-block alert alert-danger" role="alert"> Some Error </div>
80 <div class="form-group row">
81 <label for="id_1" class="control-label col-sm-3">input1</label>
82 <div class="col-sm-9">
83 <input id="id_1" type="text" name="" class="form-control form-control-sm" />
84 <div class="help-block">in 1</div>
85 </div>
86 </div>
87 </div>
88EOT;
89 $expected = $this->brutallyTrimHTML($expected);
90 $this->assertEquals($expected, $actual);
91 }
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Error.php:14

References Vendor\Package\$f, $section, ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFieldFactory().

+ Here is the call graph for this function:

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