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;
43 protected function setUp(): void
48 $this->glyph_factory = $this->createMock(
Component\Symbol\
Glyph\Factory::class);
49 $this->glyph_factory->method($this->anything())->willReturn($this->glyph_stub);
51 $this->icon_factory = $this->createMock(
Component\Symbol\
Icon\Factory::class);
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);
81 public function symbol(): Component\Symbol\Factory
90 $node_id =
'some-existing-node-id';
91 $node_name =
'some existing node name';
95 $component = $this->
getNodeFactory()->branch($node_id, $node_name,
null, $child_node_stub);
99 <li data-node-
id=
"$node_id" class=
"c-input-node c-input-node__branch c-drilldown__branch">
100 <
button type=
"button" class=
"c-drilldown__menulevel--trigger" aria-expanded=
"false">
101 <span> $this->icon_html<span data-node-name>$node_name</span></span>
102 <span> $this->glyph_html</span>
104 <
button type=
"button" class=
"c-input-node__select" aria-label=
"select_node">
105 <span data-action=
"select">$this->glyph_html</span>
106 <span
class=
"hidden" data-action=
"remove">$this->glyph_html</span>
108 <ul> $child_node_html</ul>
115 $this->brutallyTrimHTML($expected),
116 $this->brutallyTrimHTML($actual),
127 $this->assertTrue(str_contains($this->brutallyTrimHTML($actual),
"<ul></ul>"));
139 $this->assertTrue(str_contains($actual, $icon_html));
144 $first_node_name_letter =
's';
145 $node_name =
"{$first_node_name_letter}ome existing node name";
147 $this->icon_factory->expects($this->once())->method(
'standard');
148 $this->icon_stub->expects($this->once())->method(
'withAbbreviation')->with($first_node_name_letter);
155 $this->assertTrue(str_contains($actual, $this->icon_html));
160 return new Field\Node\Factory();
178 $stub = $this->createMock($class_name);
179 $html = sha1($class_name);
180 $stub->method(
'getCanonicalName')->willReturn($html);
181 $stub->method($this->anything())->willReturnSelf();
182 return [$stub, $html];
button(string $caption, string $cmd)
Component Symbol Icon Factory &MockObject $icon_factory
Component Symbol Factory &MockObject $symbol_factory
getDefaultRenderer(?JavaScriptBinding $js_binding=null, array $with_stub_renderings=[], array $with_additional_contexts=[],)
testRenderWithoutChildren()
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Component Symbol Icon Icon &MockObject $icon_stub
createSimpleRenderingStub(string $class_name)
Component Symbol Glyph Glyph &MockObject $glyph_stub
Provides common functionality for UI tests.
Component Symbol Glyph Factory &MockObject $glyph_factory
Provides methods to interface with javascript.
__construct(Container $dic, ilPlugin $plugin)