ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

Definition at line 27 of file SectionInputTest.php.

Member Function Documentation

◆ getFieldFactory()

SectionInputTest::getFieldFactory ( )

Definition at line 29 of file SectionInputTest.php.

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

Referenced by testSectionRendering(), and testSectionRenderingWithError().

29  : Field\Factory
30  {
31  $factory = new Field\Factory(
32  $this->createMock(\ILIAS\UI\Implementation\Component\Input\UploadLimitResolver::class),
34  new Data\Factory(),
35  $this->getRefinery(),
36  $this->getLanguage()
37  );
38  return $factory;
39  }
Class Factory.
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$factory
Definition: metadata.php:75
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testSectionRendering()

SectionInputTest::testSectionRendering ( )

Definition at line 41 of file SectionInputTest.php.

References Vendor\Package\$f, ILIAS\UI\Implementation\Component\Input\$inputs, ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFieldFactory().

41  : void
42  {
43  $f = $this->getFieldFactory();
44  $r = $this->getDefaultRenderer();
45  $inputs = [
46  $f->text("input1", "in 1"),
47  $f->text("input2", "in 2")
48  ];
49  $label = 'section label';
50  $byline = 'section byline';
51  $section = $f->section($inputs, $label, $byline);
52  $actual = $this->brutallyTrimHTML($r->render($section));
53  $expected = <<<EOT
54  <div class="il-section-input">
55  <div class="il-section-input-header">
56  <h2>section label</h2>
57  <div class="il-section-input-header-byline">section byline</div>
58  </div>
59  <div class="form-group row">
60  <label for="id_1" class="control-label col-sm-4 col-md-3 col-lg-2">input1</label>
61  <div class="col-sm-8 col-md-9 col-lg-10">
62  <input id="id_1" type="text" name="" class="form-control form-control-sm" />
63  <div class="help-block">in 1</div>
64  </div>
65  </div>
66  <div class="form-group row">
67  <label for="id_2" class="control-label col-sm-4 col-md-3 col-lg-2">input2</label>
68  <div class="col-sm-8 col-md-9 col-lg-10">
69  <input id="id_2" type="text" name="" class="form-control form-control-sm" />
70  <div class="help-block">in 2</div>
71  </div>
72  </div>
73  </div>
74 EOT;
75  $expected = $this->brutallyTrimHTML($expected);
76  $this->assertEquals($expected, $actual);
77  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
+ Here is the call graph for this function:

◆ testSectionRenderingWithError()

SectionInputTest::testSectionRenderingWithError ( )

Definition at line 79 of file SectionInputTest.php.

References Vendor\Package\$f, ILIAS\UI\Implementation\Component\Input\$inputs, ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFieldFactory().

79  : void
80  {
81  $f = $this->getFieldFactory();
82  $r = $this->getDefaultRenderer();
83  $inputs = [
84  $f->text("input1", "in 1")
85  ];
86  $label = 'section label';
87  $byline = 'section byline';
88  $section = $f->section($inputs, $label, $byline);
89  $actual = $this->brutallyTrimHTML($r->render($section->withError("Some Error")));
90  $expected = <<<EOT
91  <div class="il-section-input">
92  <div class="il-section-input-header">
93  <h2>section label</h2>
94  <div class="il-section-input-header-byline">section byline</div>
95  </div>
96  <div class="help-block alert alert-danger" role="alert"> Some Error </div>
97  <div class="form-group row">
98  <label for="id_1" class="control-label col-sm-4 col-md-3 col-lg-2">input1</label>
99  <div class="col-sm-8 col-md-9 col-lg-10">
100  <input id="id_1" type="text" name="" class="form-control form-control-sm" />
101  <div class="help-block">in 1</div>
102  </div>
103  </div>
104  </div>
105 EOT;
106  $expected = $this->brutallyTrimHTML($expected);
107  $this->assertEquals($expected, $actual);
108  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
+ Here is the call graph for this function:

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