ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
UrlInputTest Class Reference
+ Inheritance diagram for UrlInputTest:
+ Collaboration diagram for UrlInputTest:

Public Member Functions

 setUp ()
 
 testImplementsFactoryInterface ()
 
 testRendering ()
 
 testRenderError ()
 
 testRenderNoByline ()
 
 testRenderValue ()
 
 testRenderRequired ()
 
 testRenderDisabled ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getHelpTextRetriever ()
 
 getUploadLimitResolver ()
 
 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 testImplementsFactoryInterface(), testRenderDisabled(), testRenderError(), testRendering(), testRenderNoByline(), testRenderRequired(), and testRenderValue().

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 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  }

◆ testImplementsFactoryInterface()

UrlInputTest::testImplementsFactoryInterface ( )

Definition at line 53 of file UrlInputTest.php.

References $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 ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$url
Definition: ltiregstart.php:35
+ Here is the call graph for this function:

◆ testRenderDisabled()

UrlInputTest::testRenderDisabled ( )

Definition at line 183 of file UrlInputTest.php.

References $id, $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:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
$url
Definition: ltiregstart.php:35
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
normalizeHTML(string $html)
Definition: Base.php:453
+ Here is the call graph for this function:

◆ testRenderError()

UrlInputTest::testRenderError ( )

Definition at line 86 of file UrlInputTest.php.

References $id, $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:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
$url
Definition: ltiregstart.php:35
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
normalizeHTML(string $html)
Definition: Base.php:453
+ Here is the call graph for this function:

◆ testRendering()

UrlInputTest::testRendering ( )

Definition at line 62 of file UrlInputTest.php.

References $id, $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:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
$url
Definition: ltiregstart.php:35
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
normalizeHTML(string $html)
Definition: Base.php:453
+ Here is the call graph for this function:

◆ testRenderNoByline()

UrlInputTest::testRenderNoByline ( )

Definition at line 114 of file UrlInputTest.php.

References $id, $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:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
$url
Definition: ltiregstart.php:35
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
normalizeHTML(string $html)
Definition: Base.php:453
+ Here is the call graph for this function:

◆ testRenderRequired()

UrlInputTest::testRenderRequired ( )

Definition at line 160 of file UrlInputTest.php.

References $id, $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:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
$url
Definition: ltiregstart.php:35
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
normalizeHTML(string $html)
Definition: Base.php:453
+ Here is the call graph for this function:

◆ testRenderValue()

UrlInputTest::testRenderValue ( )

Definition at line 136 of file UrlInputTest.php.

References $id, $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:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
$url
Definition: ltiregstart.php:35
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
normalizeHTML(string $html)
Definition: Base.php:453
+ 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: