18 declare(strict_types=1);
26 require_once(__DIR__ .
"/../../../../../../../../vendor/composer/vendor/autoload.php");
27 require_once(__DIR__ .
"/../../../../Base.php");
34 protected Component\Symbol\Glyph\Glyph & MockObject
$glyph_stub;
36 protected Component\Symbol\Icon\Icon & MockObject
$icon_stub;
45 protected function setUp(): void
47 $this->uri_string = sha1(\
ILIAS\
Data\URI::class);
48 $this->uri_stub = $this->createMock(\
ILIAS\
Data\URI::class);
49 $this->uri_stub->method(
'__toString')->willReturn($this->uri_string);
54 $this->glyph_factory = $this->createMock(
Component\Symbol\
Glyph\Factory::class);
55 $this->glyph_factory->method($this->anything())->willReturn($this->glyph_stub);
57 $this->icon_factory = $this->createMock(
Component\Symbol\
Icon\Factory::class);
58 $this->icon_factory->method(
'standard')->willReturn($this->icon_stub);
60 $this->symbol_factory = $this->createMock(
Component\Symbol\Factory::class);
61 $this->symbol_factory->method(
'glyph')->willReturn($this->glyph_factory);
62 $this->symbol_factory->method(
'icon')->willReturn($this->icon_factory);
69 array $with_stub_renderings = [],
70 array $with_additional_contexts = [],
72 $with_stub_renderings = array_merge($with_stub_renderings, [
77 return parent::getDefaultRenderer($js_binding, $with_stub_renderings, $with_additional_contexts);
87 public function symbol(): Component\Symbol\Factory
96 $node_id =
'some-existing-node-id';
97 $node_name =
'some existing node name';
99 $component = $this->
getNodeFactory()->async($this->uri_stub, $node_id, $node_name);
103 <li data-node-
id=
"$node_id" class=
"c-input-node c-input-node__async c-drilldown__branch" data-render-url=
"$this->uri_string">
104 <
button type=
"button" class=
"c-drilldown__menulevel--trigger" aria-expanded=
"false">
105 <span> $this->icon_html<span data-node-name>$node_name</span></span>
106 <span> $this->glyph_html</span>
108 <
button type=
"button" class=
"c-input-node__select" aria-label=
"select_node">
109 <span data-action=
"select">$this->glyph_html</span>
110 <span
class=
"hidden" data-action=
"remove">$this->glyph_html</span>
119 $this->brutallyTrimHTML($expected),
120 $this->brutallyTrimHTML($actual),
128 $component = $this->
getNodeFactory()->async($this->uri_stub,
'', $icon_stub);
133 $this->assertTrue(str_contains($actual, $icon_html));
138 $first_node_name_letter =
's';
139 $node_name =
"{$first_node_name_letter}ome existing node name";
141 $this->icon_factory->expects($this->once())->method(
'standard');
142 $this->icon_stub->expects($this->once())->method(
'withAbbreviation')->with($first_node_name_letter);
144 $component = $this->
getNodeFactory()->async($this->uri_stub,
'', $node_name);
149 $this->assertTrue(str_contains($actual, $this->icon_html));
154 return new Field\Node\Factory();
172 $stub = $this->createMock($class_name);
173 $html = sha1($class_name);
174 $stub->method(
'getCanonicalName')->willReturn($html);
175 $stub->method($this->anything())->willReturnSelf();
176 return [$stub, $html];
button(string $caption, string $cmd)
ILIAS Data URI &MockObject $uri_stub
getDefaultRenderer(?JavaScriptBinding $js_binding=null, array $with_stub_renderings=[], array $with_additional_contexts=[],)
Interface Observer Contains several chained tasks and infos about them.
Component Symbol Icon Factory &MockObject $icon_factory
Component Symbol Glyph Glyph &MockObject $glyph_stub
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Component Symbol Glyph Factory &MockObject $glyph_factory
createSimpleRenderingStub(string $class_name)
Component Symbol Factory &MockObject $symbol_factory
Provides common functionality for UI tests.
Component Symbol Icon Icon &MockObject $icon_stub
Provides methods to interface with javascript.
__construct(Container $dic, ilPlugin $plugin)