19require_once(__DIR__ .
'/../../../../vendor/composer/vendor/autoload.php');
21require_once(__DIR__ .
'/Renderer/ilIndependentTemplate.php');
22require_once(__DIR__ .
'/../../Language/classes/class.ilLanguage.php');
38use PHPUnit\Framework\TestCase;
40use PHPUnit\Framework\MockObject\MockObject;
42use ILIAS\UI\Implementation\Component\ComponentHelper;
168 public function register(
string $name):
void
182 public function txt($a_topic, $a_default_lang_fallback_mod =
""): string
184 $this->requested[] = $a_topic;
220 $this->on_load_code[] = $code;
234 Render\
Loader $component_renderer_loader,
238 protected array $with_additional_contexts = [],
240 $this->with_stub_renderings = array_map(
function ($component) {
241 return get_class($component);
256 if (in_array(get_class($component), $this->with_stub_renderings)) {
259 return parent::getRendererFor($component);
269 return str_replace(
' ',
'-', strtolower($component->getCanonicalName()));
281 return $component->getCanonicalName();
302 return "This content was manipulated";
329 return "DummyComponent";
371 public function getRefinery()
373 return $this->getMockBuilder(\
ILIAS\Refinery\Factory::class)
374 ->disableOriginalConstructor()
385 return $this->createMock(DataFactory::class);
390 return new Help\TextRetriever\Echoing();
395 return $this->createMock(UploadLimitResolver::class);
402 public function getDefaultRenderer(
404 array $with_stub_renderings = [],
405 array $with_additional_contexts = [],
407 $ui_factory = $this->getUIFactory();
408 $tpl_factory = $this->getTemplateFactory();
409 $resource_registry = $this->getResourceRegistry();
412 $js_binding = $this->getJavaScriptBinding();
415 $image_path_resolver = $this->getImagePathResolver();
417 $help_text_retriever = $this->getHelpTextRetriever();
419 $component_renderer_loader =
new Render\LoaderCachingWrapper(
428 $image_path_resolver,
430 $help_text_retriever,
431 $this->getUploadLimitResolver()
438 $image_path_resolver,
440 $help_text_retriever,
441 $this->getUploadLimitResolver()
448 $image_path_resolver,
450 $help_text_retriever,
451 $this->getUploadLimitResolver()
458 $image_path_resolver,
460 $help_text_retriever,
461 $this->getUploadLimitResolver()
468 $image_path_resolver,
470 $help_text_retriever,
471 $this->getUploadLimitResolver()
473 new I\
Menu\MenuRendererFactory(
478 $image_path_resolver,
480 $help_text_retriever,
481 $this->getUploadLimitResolver(),
486 return new TestDefaultRenderer($component_renderer_loader, $js_binding,
$lng, $with_stub_renderings, $with_additional_contexts);
489 public function getDecoratedRenderer(
Renderer $default)
494 public function normalizeHTML(
string $html): string
496 return trim(str_replace([
"\n",
"\r"],
"", $html));
504 public function assertHTMLEquals(
string $expected_html_as_string,
string $html_as_string): void
506 $html =
new DOMDocument();
507 $html->formatOutput =
true;
508 $html->preserveWhiteSpace =
false;
509 $expected =
new DOMDocument();
510 $expected->formatOutput =
true;
511 $expected->preserveWhiteSpace =
false;
512 $html->loadXML($this->normalizeHTML($html_as_string));
513 $expected->loadXML($this->normalizeHTML($expected_html_as_string));
514 $this->assertEquals($expected->saveHTML(), $html->saveHTML());
521 protected function brutallyTrimHTML(
string $html): string
523 $html = str_replace([
"\n",
"\r",
"\t"],
"", $html);
524 $html = preg_replace(
'# {2,}#',
" ", $html);
525 $html = preg_replace(
'/<!--(.|\s)*?-->/',
'', $html);
526 $html = preg_replace(
"/>(\s+)</",
"><", $html);
527 $html = str_replace(
" >",
">", $html);
528 $html = str_replace(
" <",
"<", $html);
536 protected function brutallyTrimSignals(
string $html): string
538 $html = preg_replace(
'/il_signal_(\w+)/',
"il_signal...", $html);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getCanonicalName()
Get the canonical name of the component.
A Link is the often used combination of a label and an URL.
Renderer that dispatches rendering of UI components to a Renderer found in the same namespace as the ...
getContexts()
Returns the current context stack, where most recently added components are last.
pushContext(Component $component)
Adds a component to the current context stack.
Loads renderers for components from the file system.
Registers resources for retreived renderers at a ResourceRegistry.
Provides common functionality for UI tests.
toJS($a_lang_key, ?ilGlobalTemplateInterface $a_tpl=null)
Transfer text to Javascript.
getLangKey()
Return lang key.
txt($a_topic, $a_default_lang_fallback_mod="")
loadLanguageModule(string $a_module)
Load language module.
createId()
Create a fresh unique id.
getOnLoadCodeAsync()
Get all the registered on-load javascript code for the async context, e.g.
helpTopics(string ... $topic)
breadcrumbs(array $crumbs)
manipulateRendering($component, Renderer $root)
Manipulates the rendering of one or multiple components by appending, prepending or exchanging their ...
_getRendererFor(IComponent $component)
getComponentCanonicalNameAttribute(IComponent $component)
array $with_stub_renderings
__construct(Render\Loader $component_renderer_loader, JavaScriptBinding $java_script_binding, \ILIAS\Language\Language $language, array $with_stub_renderings=[], protected array $with_additional_contexts=[],)
getRendererFor(IComponent $component)
registerResources(ResourceRegistry $registry)
render(ILIAS\UI\Component\Component $component, ILIAS\UI\Renderer $default_renderer)
getTemplate(string $path, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template instance.
A component is the most general form of an entity in the UI.
This describes a facility that the UI framework can use to retrieve some help text.
An entity that renders components to a string output.
Provides methods to interface with javascript.
Loads renderers for components.
Registry for resources required by rendered output like Javascript or CSS.
Interface for a factory that provides templates.
Interface to templating as it is used in the UI framework.
An entity that renders components to a string output.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.