19 declare(strict_types=1);
23 require_once(__DIR__ .
"/../../Base.php");
40 protected function setUp(): void
42 $this->glyph_html = sha1(
C\Symbol\Glyph\Glyph::class);
44 $this->glyph_mock = $this->createMock(
I\Symbol\Glyph\Glyph::class);
45 $this->glyph_mock->method(
'getCanonicalName')->willReturn($this->glyph_html);
47 $this->glyph_factory = $this->createMock(
I\Symbol\Glyph\Factory::class);
48 $this->glyph_factory->method(
'apply')->willReturn($this->glyph_mock);
49 $this->glyph_factory->method(
'close')->willReturn($this->glyph_mock);
51 $this->uri = sha1(
'https://example.com?foo=bar&bar=foobar');
53 $this->uri_mock = $this->createMock(\
ILIAS\
Data\URI::class);
54 $this->uri_mock->method(
'__toString')->willReturn($this->uri);
56 $this->signal_generator = new \IncrementalSignalGenerator();
63 $label = sha1(
'progress_bar_label');
65 $progress_bar = $this->
getUIFactory()->progress()->bar($label);
67 $renderer = $this->getDefaultRenderer(
null, [$this->glyph_mock]);
69 $actual_html =
$renderer->render($progress_bar);
71 $expected_html = <<<EOT
72 <div
class=
"c-progress c-progress-bar">
73 <div
class=
"c-progress-bar__label"><label
for=
"id_1">$label</label>
74 <span data-status=
"success" class=
"c-progress-bar--success hidden">$this->glyph_html</span>
75 <span data-status=
"failure" class=
"c-progress-bar--failure hidden">$this->glyph_html</span>
77 <progress
id=
"id_1" class=
"c-progress-bar__progress" value=
"0" max=
"100"></progress>
78 <div
class=
"c-progress-bar__message text-left invisible" aria-live=
"polite"></div>
83 $this->brutallyTrimHTML($expected_html),
84 $this->brutallyTrimHTML($actual_html),
90 $label = sha1(
'progress_bar_label');
92 $progress_bar = $this->
getUIFactory()->progress()->bar($label, $this->uri_mock);
94 $renderer = $this->getDefaultRenderer(
null, [$this->glyph_mock]);
96 $actual_html =
$renderer->render($progress_bar);
98 $expected_html =
"data-url=\"$this->uri\"";
101 str_contains($actual_html, $expected_html)
107 $symbol_factory =
new I\Symbol\Factory(
108 $this->createMock(
I\Symbol\
Icon\Factory::class),
109 $this->glyph_factory,
110 $this->createMock(
I\Symbol\Avatar\Factory::class),
113 $progress_factory =
new I\Progress\Factory(
114 $this->createMock(
C\Progress\AsyncRefreshInterval::class),
115 $this->signal_generator,
116 $this->createMock(
I\Progress\State\Factory::class),
119 return new class ($progress_factory, $symbol_factory) extends \
NoUIFactory {
121 protected I\Progress\Factory $progress_factory,
122 protected I\Symbol\Factory $symbol_factory,
125 public function progress(): I\Progress\Factory
127 return $this->progress_factory;
129 public function symbol(): I\Symbol\Factory
131 return $this->symbol_factory;
Interface Observer Contains several chained tasks and infos about them.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Provides common functionality for UI tests.
I Symbol Glyph Glyph $glyph_mock
I SignalGeneratorInterface $signal_generator
__construct(Container $dic, ilPlugin $plugin)
I Symbol Glyph Factory $glyph_factory