18 declare(strict_types=1);
22 require_once(__DIR__ .
"/../../Base.php");
39 protected function setUp(): void
41 $this->glyph_html = sha1(
C\Symbol\Glyph\Glyph::class);
43 $this->glyph_mock = $this->createMock(
C\Symbol\Glyph\Glyph::class);
44 $this->glyph_mock->method(
'getCanonicalName')->willReturn($this->glyph_html);
46 $this->glyph_factory = $this->createMock(
I\Symbol\Glyph\Factory::class);
47 $this->glyph_factory->method(
'apply')->willReturn($this->glyph_mock);
48 $this->glyph_factory->method(
'close')->willReturn($this->glyph_mock);
50 $this->uri = sha1(
'https://example.com?foo=bar&bar=foobar');
52 $this->uri_mock = $this->createMock(\
ILIAS\
Data\URI::class);
53 $this->uri_mock->method(
'__toString')->willReturn($this->uri);
55 $this->signal_generator = new \IncrementalSignalGenerator();
62 $label = sha1(
'progress_bar_label');
64 $progress_bar = $this->
getUIFactory()->progress()->bar($label);
66 $renderer = $this->getDefaultRenderer(null, [$this->glyph_mock]);
68 $actual_html =
$renderer->render($progress_bar);
70 $expected_html = <<<EOT
71 <div
class=
"c-progress c-progress-bar">
72 <div
class=
"c-progress-bar__label"><label
for=
"id_1">$label</label>
73 <span data-status=
"success" class=
"c-progress-bar--success hidden">$this->glyph_html</span>
74 <span data-status=
"failure" class=
"c-progress-bar--failure hidden">$this->glyph_html</span>
76 <progress
id=
"id_1" class=
"c-progress-bar__progress" value=
"0" max=
"100"></progress>
77 <div
class=
"c-progress-bar__message text-left invisible" aria-live=
"polite"></div>
82 $this->brutallyTrimHTML($expected_html),
83 $this->brutallyTrimHTML($actual_html),
89 $label = sha1(
'progress_bar_label');
91 $progress_bar = $this->
getUIFactory()->progress()->bar($label, $this->uri_mock);
93 $renderer = $this->getDefaultRenderer(null, [$this->glyph_mock]);
95 $actual_html =
$renderer->render($progress_bar);
97 $expected_html =
"data-url=\"$this->uri\"";
100 str_contains($actual_html, $expected_html)
106 $symbol_factory =
new I\Symbol\Factory(
107 $this->createMock(
I\Symbol\
Icon\Factory::class),
108 $this->glyph_factory,
109 $this->createMock(
I\Symbol\Avatar\Factory::class),
112 $progress_factory =
new I\Progress\Factory(
113 $this->createMock(
C\Progress\AsyncRefreshInterval::class),
114 $this->signal_generator,
115 $this->createMock(
C\Progress\State\Factory::class),
118 return new class ($progress_factory, $symbol_factory) extends \
NoUIFactory {
120 protected C\Progress\Factory $progress_factory,
121 protected C\Symbol\Factory $symbol_factory,
124 public function progress(): C\Progress\Factory
126 return $this->progress_factory;
128 public function symbol(): C\Symbol\Factory
130 return $this->symbol_factory;
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Provides common functionality for UI tests.
C Symbol Glyph Glyph $glyph_mock
I SignalGeneratorInterface $signal_generator
__construct(Container $dic, ilPlugin $plugin)
I Symbol Glyph Factory $glyph_factory