ILIAS  release_8 Revision v8.23
UrlInputTest Class Reference
+ Inheritance diagram for UrlInputTest:
+ Collaboration diagram for UrlInputTest:

Public Member Functions

 setUp ()
 
 test_implements_factory_interface ()
 
 test_rendering ()
 
 test_render_error ()
 
 test_render_no_byline ()
 
 test_render_value ()
 
 test_render_required ()
 
 test_render_disabled ()
 
- 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)
 

Protected Member Functions

 buildFactory ()
 
- 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...
 

Private Attributes

DefNamesource $name_source
 

Detailed Description

Definition at line 31 of file UrlInputTest.php.

Member Function Documentation

◆ buildFactory()

UrlInputTest::buildFactory ( )
protected

Definition at line 40 of file UrlInputTest.php.

Referenced by test_implements_factory_interface(), test_render_disabled(), test_render_error(), test_render_no_byline(), test_render_required(), test_render_value(), and test_rendering().

40  : I\Input\Field\Factory
41  {
42  $data_factory = new Data\Factory();
43  $language = $this->createMock(ilLanguage::class);
44  return new I\Input\Field\Factory(
45  $this->createMock(\ILIAS\UI\Implementation\Component\Input\UploadLimitResolver::class),
46  new SignalGenerator(),
47  $data_factory,
48  new Refinery($data_factory, $language),
49  $language
50  );
51  }
Class Factory.
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ setUp()

UrlInputTest::setUp ( )

Definition at line 35 of file UrlInputTest.php.

35  : void
36  {
37  $this->name_source = new DefNamesource();
38  }

◆ test_implements_factory_interface()

UrlInputTest::test_implements_factory_interface ( )

Definition at line 53 of file UrlInputTest.php.

References $factory, $url, and buildFactory().

53  : void
54  {
55  $factory = $this->buildFactory();
56  $url = $factory->url("Test Label", "Test Byline");
57 
58  $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $url);
59  $this->assertInstanceOf(Field\Url::class, $url);
60  }
Class Factory.
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$url
$factory
Definition: metadata.php:75
+ Here is the call graph for this function:

◆ test_render_disabled()

UrlInputTest::test_render_disabled ( )

Definition at line 183 of file UrlInputTest.php.

References $factory, $id, $name, $url, ILIAS_UI_TestBase\brutallyTrimHTML(), buildFactory(), ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\normalizeHTML().

183  : void
184  {
185  $factory = $this->buildFactory();
186  $renderer = $this->getDefaultRenderer();
187  $label = "Test Label";
188  $id = "id_1";
189  $name = "name_0";
190  $url = $factory->url($label)->withNameFrom($this->name_source)
191  ->withDisabled(true);
192  $html = $this->normalizeHTML($renderer->render($url));
193 
194  $expected = "<div class=\"form-group row\">
195  <label for=\"$id\" class=\"control-label col-sm-4 col-md-3 col-lg-2\">$label</label>
196  <div class=\"col-sm-8 col-md-9 col-lg-10\">
197  <input id=\"$id\" type=\"url\" name=\"$name\" disabled=\"disabled\" class=\"form-control form-control-sm\" />
198  </div>
199  </div>";
200 
201  $this->assertEquals(
202  $this->brutallyTrimHTML($expected),
203  $this->brutallyTrimHTML($html)
204  );
205  }
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
if($format !==null) $name
Definition: metadata.php:247
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$url
normalizeHTML(string $html)
Definition: Base.php:422
$factory
Definition: metadata.php:75
+ Here is the call graph for this function:

◆ test_render_error()

UrlInputTest::test_render_error ( )

Definition at line 86 of file UrlInputTest.php.

References $factory, $id, $name, $url, ILIAS_UI_TestBase\brutallyTrimHTML(), buildFactory(), ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\normalizeHTML().

86  : void
87  {
88  $factory = $this->buildFactory();
89  $renderer = $this->getDefaultRenderer();
90  $label = "Test Label";
91  $byline = "Test Byline";
92  $id = "id_1";
93  $name = "name_0";
94  $error = "test_error";
95  $url = $factory->url($label, $byline)->withNameFrom($this->name_source)
96  ->withError($error);
97  $html = $this->normalizeHTML($renderer->render($url));
98 
99  $expected = "<div class=\"form-group row\">
100  <label for=\"$id\" class=\"control-label col-sm-4 col-md-3 col-lg-2\">$label</label>
101  <div class=\"col-sm-8 col-md-9 col-lg-10\">
102  <div class=\"help-block alert alert-danger\" aria-describedby=\"id_1\" role=\"alert\">$error</div>
103  <input id=\"$id\" type=\"url\" name=\"$name\" class=\"form-control form-control-sm\" />
104  <div class=\"help-block\">$byline</div>
105  </div>
106  </div>";
107 
108  $this->assertEquals(
109  $this->brutallyTrimHTML($expected),
110  $this->brutallyTrimHTML($html)
111  );
112  }
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
if($format !==null) $name
Definition: metadata.php:247
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$url
normalizeHTML(string $html)
Definition: Base.php:422
$factory
Definition: metadata.php:75
+ Here is the call graph for this function:

◆ test_render_no_byline()

UrlInputTest::test_render_no_byline ( )

Definition at line 114 of file UrlInputTest.php.

References $factory, $id, $name, $url, ILIAS_UI_TestBase\brutallyTrimHTML(), buildFactory(), ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\normalizeHTML().

114  : void
115  {
116  $factory = $this->buildFactory();
117  $renderer = $this->getDefaultRenderer();
118  $label = "Test Label";
119  $id = "id_1";
120  $name = "name_0";
121  $url = $factory->url($label)->withNameFrom($this->name_source);
122  $html = $this->normalizeHTML($renderer->render($url));
123 
124  $expected = "<div class=\"form-group row\">
125  <label for=\"$id\" class=\"control-label col-sm-4 col-md-3 col-lg-2\">$label</label>
126  <div class=\"col-sm-8 col-md-9 col-lg-10\">
127  <input id=\"$id\" type=\"url\" name=\"$name\" class=\"form-control form-control-sm\" />
128  </div>
129  </div>";
130  $this->assertEquals(
131  $this->brutallyTrimHTML($expected),
132  $this->brutallyTrimHTML($html)
133  );
134  }
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
if($format !==null) $name
Definition: metadata.php:247
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$url
normalizeHTML(string $html)
Definition: Base.php:422
$factory
Definition: metadata.php:75
+ Here is the call graph for this function:

◆ test_render_required()

UrlInputTest::test_render_required ( )

Definition at line 160 of file UrlInputTest.php.

References $factory, $id, $name, $url, ILIAS_UI_TestBase\brutallyTrimHTML(), buildFactory(), ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\normalizeHTML().

160  : void
161  {
162  $factory = $this->buildFactory();
163  $renderer = $this->getDefaultRenderer();
164  $label = "Test Label";
165  $id = "id_1";
166  $name = "name_0";
167  $url = $factory->url($label)->withNameFrom($this->name_source)
168  ->withRequired(true);
169  $html = $this->normalizeHTML($renderer->render($url));
170 
171  $expected = "<div class=\"form-group row\">
172  <label for=\"$id\" class=\"control-label col-sm-4 col-md-3 col-lg-2\">$label<span class=\"asterisk\">*</span></label>
173  <div class=\"col-sm-8 col-md-9 col-lg-10\">
174  <input id=\"$id\" type=\"url\" name=\"$name\" class=\"form-control form-control-sm\" />
175  </div>
176  </div>";
177  $this->assertEquals(
178  $this->brutallyTrimHTML($expected),
179  $this->brutallyTrimHTML($html)
180  );
181  }
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
if($format !==null) $name
Definition: metadata.php:247
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$url
normalizeHTML(string $html)
Definition: Base.php:422
$factory
Definition: metadata.php:75
+ Here is the call graph for this function:

◆ test_render_value()

UrlInputTest::test_render_value ( )

Definition at line 136 of file UrlInputTest.php.

References $factory, $id, $name, $url, ILIAS_UI_TestBase\brutallyTrimHTML(), buildFactory(), ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\normalizeHTML().

136  : void
137  {
138  $factory = $this->buildFactory();
139  $renderer = $this->getDefaultRenderer();
140  $label = "Test Label";
141  $value = "https://www.ilias.de/";
142  $id = "id_1";
143  $name = "name_0";
144  $url = $factory->url($label)->withValue($value)
145  ->withNameFrom($this->name_source);
146  $html = $this->normalizeHTML($renderer->render($url));
147 
148  $expected = "<div class=\"form-group row\">
149  <label for=\"$id\" class=\"control-label col-sm-4 col-md-3 col-lg-2\">$label</label>
150  <div class=\"col-sm-8 col-md-9 col-lg-10\">
151  <input id=\"$id\" type=\"url\" value=\"$value\" name=\"$name\" class=\"form-control form-control-sm\" />
152  </div>
153  </div>";
154  $this->assertEquals(
155  $this->brutallyTrimHTML($expected),
156  $this->brutallyTrimHTML($html)
157  );
158  }
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
if($format !==null) $name
Definition: metadata.php:247
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$url
normalizeHTML(string $html)
Definition: Base.php:422
$factory
Definition: metadata.php:75
+ Here is the call graph for this function:

◆ test_rendering()

UrlInputTest::test_rendering ( )

Definition at line 62 of file UrlInputTest.php.

References $factory, $id, $name, $url, ILIAS_UI_TestBase\brutallyTrimHTML(), buildFactory(), ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\normalizeHTML().

62  : void
63  {
64  $factory = $this->buildFactory();
65  $renderer = $this->getDefaultRenderer();
66  $label = "Test Label";
67  $byline = "Test Byline";
68  $id = "id_1";
69  $name = "name_0";
70  $url = $factory->url($label, $byline)->withNameFrom($this->name_source);
71  $html = $this->normalizeHTML($renderer->render($url));
72 
73  $expected = "<div class=\"form-group row\">
74  <label for=\"$id\" class=\"control-label col-sm-4 col-md-3 col-lg-2\">$label</label>
75  <div class=\"col-sm-8 col-md-9 col-lg-10\">
76  <input id=\"$id\" type=\"url\" name=\"$name\" class=\"form-control form-control-sm\" />
77  <div class=\"help-block\">$byline</div>
78  </div>
79  </div>";
80  $this->assertEquals(
81  $this->brutallyTrimHTML($expected),
82  $this->brutallyTrimHTML($html)
83  );
84  }
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
if($format !==null) $name
Definition: metadata.php:247
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$url
normalizeHTML(string $html)
Definition: Base.php:422
$factory
Definition: metadata.php:75
+ Here is the call graph for this function:

Field Documentation

◆ $name_source

DefNamesource UrlInputTest::$name_source
private

Definition at line 33 of file UrlInputTest.php.


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