18declare(strict_types=1);
24use PHPUnit\Framework\MockObject\MockObject;
26require_once(__DIR__ .
"/../../../../../../../../vendor/composer/vendor/autoload.php");
27require_once(__DIR__ .
"/../../../../Base.php");
43 protected function setUp(): void
49 $this->glyph_factory->method($this->anything())->willReturn($this->glyph_stub);
52 $this->icon_factory->method(
'standard')->willReturn($this->icon_stub);
54 $this->symbol_factory = $this->createMock(
Component\
Symbol\Factory::class);
55 $this->symbol_factory->method(
'glyph')->willReturn($this->glyph_factory);
56 $this->symbol_factory->method(
'icon')->willReturn($this->icon_factory);
63 array $with_stub_renderings = [],
64 array $with_additional_contexts = [],
66 $with_stub_renderings = array_merge($with_stub_renderings, [
71 return parent::getDefaultRenderer($js_binding, $with_stub_renderings, $with_additional_contexts);
76 return new class ($this->symbol_factory) extends \
NoUIFactory {
83 return $this->symbol_factory;
90 $node_id =
'some-existing-node-id';
91 $node_name =
'some existing node name';
93 $component = $this->getNodeFactory()->leaf($node_id, $node_name);
97<li data-node-
id=
"$node_id" class=
"c-input-node c-input-node__leaf c-drilldown__leaf">
98 <p
class=
"il-link link-bulky c-input-node__name" tabindex=
"0">
99 $this->icon_html<span data-node-name>$node_name</span>
101 <
button type=
"button" class=
"c-input-node__select" aria-label=
"select_node">
102 <span data-action=
"select">$this->glyph_html</span>
103 <span
class=
"hidden" data-action=
"remove">$this->glyph_html</span>
111 $this->brutallyTrimHTML($expected),
112 $this->brutallyTrimHTML($actual),
118 [$icon_stub, $icon_html] = $this->createSimpleRenderingStub(
Component\
Symbol\
Icon\Custom::class);
120 $component = $this->getNodeFactory()->leaf(
'',
'');
121 $renderer = $this->getDefaultRenderer(
null, [$icon_stub]);
125 $this->assertTrue(str_contains($actual, $icon_html));
130 $first_node_name_letter =
's';
131 $node_name =
"{$first_node_name_letter}ome existing node name";
133 $this->icon_factory->expects($this->once())->method(
'standard');
134 $this->icon_stub->expects($this->once())->method(
'withAbbreviation')->with($first_node_name_letter);
136 $component = $this->getNodeFactory()->leaf(
'', $node_name);
141 $this->assertTrue(str_contains($actual, $this->icon_html));
164 $stub = $this->createMock($class_name);
165 $html = sha1($class_name);
166 $stub->method(
'getCanonicalName')->willReturn($html);
167 $stub->method($this->anything())->willReturnSelf();
168 return [$stub, $html];
Component Symbol Icon Factory &MockObject $icon_factory
createSimpleRenderingStub(string $class_name)
Component Symbol Icon Icon &MockObject $icon_stub
Component Symbol Factory &MockObject $symbol_factory
Component Symbol Glyph Factory &MockObject $glyph_factory
Component Symbol Glyph Glyph &MockObject $glyph_stub
getDefaultRenderer(?JavaScriptBinding $js_binding=null, array $with_stub_renderings=[], array $with_additional_contexts=[],)
Provides common functionality for UI tests.
Provides methods to interface with javascript.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
button(string $caption, string $cmd)