ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ILIAS_UI_TestBase Class Reference

Provides common functionality for UI tests. More...

+ Inheritance diagram for ILIAS_UI_TestBase:
+ Collaboration diagram for ILIAS_UI_TestBase:

Public Member Functions

 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Detailed Description

Provides common functionality for UI tests.

Definition at line 177 of file Base.php.

Member Function Documentation

◆ assertHTMLEquals()

ILIAS_UI_TestBase::assertHTMLEquals (   $expected_html_as_string,
  $html_as_string 
)
Parameters
string$expected_html_as_string
string$html_as_string

Definition at line 252 of file Base.php.

References $html.

Referenced by ButtonMonthTest\test_render(), ChartScaleBarTest\test_render(), PanelListingTest\test_render_base(), ItemGroupTest\test_render_base(), ItemTest\test_render_base(), ButtonTest\test_render_button_disabled(), ButtonTest\test_render_button_label(), ButtonTest\test_render_button_with_aria_checked(), ButtonTest\test_render_button_with_aria_label(), ButtonTest\test_render_button_with_on_load_code(), DeckTest\test_render_content(), CardTest\test_render_content_empty(), CardTest\test_render_content_full(), CardTest\test_render_content_with_highlight(), DividerTest\test_render_horizontal_empty(), DividerTest\test_render_horizontal_with_label(), DropdownTest\test_render_items(), DropdownTest\test_render_items_with_label(), ItemTest\test_render_lead_image(), ItemTest\test_render_lead_text_and_color(), LinkTest\test_render_link(), ViewControlTest\test_render_viewcontrol_mode(), ViewControlTest\test_render_viewcontrol_section(), ItemGroupTest\test_render_with_actions(), PanelListingTest\test_render_with_actions(), LinkTest\test_render_with_new_viewport(), ItemTest\test_shy_title_and_property(), RoundTripTest\test_simple_rendering(), and BreadcrumbsTest\testRendering().

253  {
254  $html = new DOMDocument();
255  $html->formatOutput = true;
256  $html->preserveWhiteSpace = false;
257  $expected = new DOMDocument();
258  $expected->formatOutput = true;
259  $expected->preserveWhiteSpace = false;
260  $html->loadXML($this->normalizeHTML($html_as_string));
261  $expected->loadXML($this->normalizeHTML($expected_html_as_string));
262  $this->assertEquals($expected->saveHTML(), $html->saveHTML());
263  }
normalizeHTML($html)
Definition: Base.php:243
$html
Definition: example_001.php:87
+ Here is the caller graph for this function:

◆ getDefaultRenderer()

ILIAS_UI_TestBase::getDefaultRenderer ( JavaScriptBinding  $js_binding = null)

Definition at line 216 of file Base.php.

References $lng.

Referenced by ButtonTest\test_____render_close_button_with_on_load_code(), GlyphTest\test_dont_render_counter(), DefaultRendererTest\test_getContexts(), DefaultRendererTest\test_getRenderer_caching(), DefaultRendererTest\test_getRenderer_successfully(), DefaultRendererTest\test_invokesRegistry(), ButtonMonthTest\test_render(), ChartScaleBarTest\test_render(), DefaultRendererTest\test_render(), ImageTest\test_render_alt_escaping(), PopoverTest\test_render_async(), DefaultRendererTest\test_render_async_array(), DefaultRendererTest\test_render_async_no_js(), DefaultRendererTest\test_render_async_with_js(), DefaultRendererTest\test_render_async_with_js_twice(), PanelListingTest\test_render_base(), ItemGroupTest\test_render_base(), ItemTest\test_render_base(), ButtonTest\test_render_btn_tag_classes(), ButtonTest\test_render_btn_tag_colors(), ButtonTest\test_render_btn_tag_relevance(), ButtonTest\test_render_button_disabled(), ButtonTest\test_render_button_label(), ButtonTest\test_render_button_with_aria_checked(), ButtonTest\test_render_button_with_aria_label(), ButtonTest\test_render_button_with_on_load_code(), ButtonTest\test_render_close_button(), LegacyTest\test_render_content(), DeckTest\test_render_content(), CardTest\test_render_content_empty(), CardTest\test_render_content_full(), CardTest\test_render_content_with_highlight(), ListingTest\test_render_descriptive_listing(), DropdownTest\test_render_empty(), DividerTest\test_render_horizontal_empty(), DividerTest\test_render_horizontal_with_label(), DropdownTest\test_render_items(), DropdownTest\test_render_items_with_label(), ItemTest\test_render_lead_image(), ItemTest\test_render_lead_text_and_color(), LinkTest\test_render_link(), ListingTest\test_render_ordered_listing(), ImageTest\test_render_responsive(), GlyphTest\test_render_simple(), PopoverTest\test_render_standard(), ImageTest\test_render_standard(), CounterTest\test_render_status(), ListingTest\test_render_unordered_listing(), ViewControlTest\test_render_viewcontrol_mode(), ViewControlTest\test_render_viewcontrol_section(), ImageTest\test_render_with_action(), ItemGroupTest\test_render_with_actions(), PanelListingTest\test_render_with_actions(), LinkTest\test_render_with_new_viewport(), GlyphTest\test_render_with_on_load_code(), GlyphTest\test_render_withCounter(), GlyphTest\test_render_withTwoCounters(), ItemTest\test_shy_title_and_property(), LightboxTest\test_simple_rendering(), RoundTripTest\test_simple_rendering(), InterruptiveTest\test_simple_rendering(), ViewControlTest\test_viewcontrol_get_actions(), DefaultRendererTest\test_withAdditionalContext_clones(), BreadcrumbsTest\testRendering(), SortationTest\testRendering(), IconTest\testRenderingCustom(), IconTest\testRenderingStandard(), DropzoneRendererTest\testRenderMetadata(), DropzoneRendererTest\testRenderStandardDropzone(), DropzoneRendererTest\testRenderStandardDropzoneWithMessage(), DropzoneRendererTest\testRenderWrapperDropzone(), and DropzoneRendererTest\testWithButton().

217  {
218  $ui_factory = $this->getUIFactory();
219  $tpl_factory = $this->getTemplateFactory();
220  $resource_registry = $this->getResourceRegistry();
221  $lng = $this->getLanguage();
222  if (!$js_binding) {
223  $js_binding = $this->getJavaScriptBinding();
224  }
225 
226  $component_renderer_loader
227  = new Render\LoaderCachingWrapper(
229  $resource_registry,
230  new Render\FSLoader(
232  $ui_factory,
233  $tpl_factory,
234  $lng,
235  $js_binding
236  )
237  )
238  )
239  );
240  return new TestDefaultRenderer($component_renderer_loader);
241  }
Loads renderers for components from the file system.
Definition: FSLoader.php:20
Registers resources for retreived renderers at a ResourceRegistry.
getJavaScriptBinding()
Definition: Base.php:211
getTemplateFactory()
Definition: Base.php:196
getResourceRegistry()
Definition: Base.php:201
global $lng
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ getJavaScriptBinding()

ILIAS_UI_TestBase::getJavaScriptBinding ( )

Definition at line 211 of file Base.php.

Referenced by GlyphTest\test_dont_render_counter().

212  {
213  return new LoggingJavaScriptBinding();
214  }
+ Here is the caller graph for this function:

◆ getLanguage()

ILIAS_UI_TestBase::getLanguage ( )

Definition at line 206 of file Base.php.

Referenced by GlyphTest\test_dont_render_counter().

207  {
208  return new ilLanguageMock();
209  }
+ Here is the caller graph for this function:

◆ getResourceRegistry()

ILIAS_UI_TestBase::getResourceRegistry ( )

Definition at line 201 of file Base.php.

202  {
203  return new LoggingRegistry();
204  }

◆ getTemplateFactory()

◆ getUIFactory()

ILIAS_UI_TestBase::getUIFactory ( )

Definition at line 191 of file Base.php.

Referenced by GlyphTest\test_dont_render_counter().

192  {
193  return new NoUIFactory();
194  }
+ Here is the caller graph for this function:

◆ normalizeHTML()

◆ setUp()

ILIAS_UI_TestBase::setUp ( )

Definition at line 179 of file Base.php.

180  {
181  assert_options(ASSERT_WARNING, 0);
182  assert_options(ASSERT_CALLBACK, null);
183  }

◆ tearDown()

ILIAS_UI_TestBase::tearDown ( )

Definition at line 185 of file Base.php.

186  {
187  assert_options(ASSERT_WARNING, 1);
188  assert_options(ASSERT_CALLBACK, null);
189  }

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