ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
Component\Progress\BarTest Class Reference
+ Inheritance diagram for Component\Progress\BarTest:
+ Collaboration diagram for Component\Progress\BarTest:

Public Member Functions

 testRender ()
 
 testRenderWithAsyncUrl ()
 
 getUIFactory ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

I SignalGeneratorInterface $signal_generator
 
I Symbol Glyph Factory $glyph_factory
 
C Symbol Glyph Glyph $glyph_mock
 
string $glyph_html
 
ILIAS Data URI $uri_mock
 
string $uri
 

Detailed Description

Author
Thibeau Fuhrer thibe.nosp@m.au@s.nosp@m.r.sol.nosp@m.utio.nosp@m.ns

Definition at line 30 of file BarTest.php.

Member Function Documentation

◆ getUIFactory()

Component\Progress\BarTest::getUIFactory ( )

Definition at line 104 of file BarTest.php.

References ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\symbol().

Referenced by Component\Progress\BarTest\testRender(), and Component\Progress\BarTest\testRenderWithAsyncUrl().

104  : \NoUIFactory
105  {
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),
110  );
111 
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),
116  );
117 
118  return new class ($progress_factory, $symbol_factory) extends \NoUIFactory {
119  public function __construct(
120  protected C\Progress\Factory $progress_factory,
121  protected C\Symbol\Factory $symbol_factory,
122  ) {
123  }
124  public function progress(): C\Progress\Factory
125  {
126  return $this->progress_factory;
127  }
128  public function symbol(): C\Symbol\Factory
129  {
130  return $this->symbol_factory;
131  }
132  };
133  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUp()

Component\Progress\BarTest::setUp ( )
protected

Definition at line 39 of file BarTest.php.

39  : void
40  {
41  $this->glyph_html = sha1(C\Symbol\Glyph\Glyph::class);
42 
43  $this->glyph_mock = $this->createMock(C\Symbol\Glyph\Glyph::class);
44  $this->glyph_mock->method('getCanonicalName')->willReturn($this->glyph_html);
45 
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);
49 
50  $this->uri = sha1('https://example.com?foo=bar&bar=foobar');
51 
52  $this->uri_mock = $this->createMock(\ILIAS\Data\URI::class);
53  $this->uri_mock->method('__toString')->willReturn($this->uri);
54 
55  $this->signal_generator = new \IncrementalSignalGenerator();
56 
57  parent::setUp();
58  }
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...

◆ testRender()

Component\Progress\BarTest::testRender ( )

Definition at line 60 of file BarTest.php.

References $renderer, and Component\Progress\BarTest\getUIFactory().

60  : void
61  {
62  $label = sha1('progress_bar_label');
63 
64  $progress_bar = $this->getUIFactory()->progress()->bar($label);
65 
66  $renderer = $this->getDefaultRenderer(null, [$this->glyph_mock]);
67 
68  $actual_html = $renderer->render($progress_bar);
69 
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>
75  </div>
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>
78 </div>
79 EOT;
80 
81  $this->assertEquals(
82  $this->brutallyTrimHTML($expected_html),
83  $this->brutallyTrimHTML($actual_html),
84  );
85  }
$renderer
+ Here is the call graph for this function:

◆ testRenderWithAsyncUrl()

Component\Progress\BarTest::testRenderWithAsyncUrl ( )

Definition at line 87 of file BarTest.php.

References $renderer, and Component\Progress\BarTest\getUIFactory().

87  : void
88  {
89  $label = sha1('progress_bar_label');
90 
91  $progress_bar = $this->getUIFactory()->progress()->bar($label, $this->uri_mock);
92 
93  $renderer = $this->getDefaultRenderer(null, [$this->glyph_mock]);
94 
95  $actual_html = $renderer->render($progress_bar);
96 
97  $expected_html = "data-url=\"$this->uri\"";
98 
99  $this->assertTrue(
100  str_contains($actual_html, $expected_html)
101  );
102  }
$renderer
+ Here is the call graph for this function:

Field Documentation

◆ $glyph_factory

I Symbol Glyph Factory Component\Progress\BarTest::$glyph_factory
protected

Definition at line 33 of file BarTest.php.

◆ $glyph_html

string Component\Progress\BarTest::$glyph_html
protected

Definition at line 35 of file BarTest.php.

◆ $glyph_mock

C Symbol Glyph Glyph Component\Progress\BarTest::$glyph_mock
protected

Definition at line 34 of file BarTest.php.

◆ $signal_generator

I SignalGeneratorInterface Component\Progress\BarTest::$signal_generator
protected

Definition at line 32 of file BarTest.php.

◆ $uri

string Component\Progress\BarTest::$uri
protected

Definition at line 37 of file BarTest.php.

◆ $uri_mock

ILIAS Data URI Component\Progress\BarTest::$uri_mock
protected

Definition at line 36 of file BarTest.php.


The documentation for this class was generated from the following file: