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

Public Member Functions

 testDeterminateConstructionWithNegativeNumber ()
 
 testDeterminateConstructionWithMaximumValue ()
 
 testRenderIndeterminate ()
 
 testRenderDeterminate ()
 
 testRenderSuccess ()
 
 testRenderFailure ()
 
 getUIFactory ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

string $indeterminate_status_value
 
string $determinate_status_value
 
string $success_status_value
 
string $failure_status_value
 
string $message
 

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 BarStateTest.php.

Member Function Documentation

◆ getUIFactory()

Component\Progress\BarStateTest::getUIFactory ( )

Definition at line 193 of file BarStateTest.php.

References ILIAS\GlobalScreen\Provider\__construct().

Referenced by Component\Progress\BarStateTest\setUp(), Component\Progress\BarStateTest\testDeterminateConstructionWithMaximumValue(), Component\Progress\BarStateTest\testDeterminateConstructionWithNegativeNumber(), Component\Progress\BarStateTest\testRenderDeterminate(), Component\Progress\BarStateTest\testRenderFailure(), Component\Progress\BarStateTest\testRenderIndeterminate(), and Component\Progress\BarStateTest\testRenderSuccess().

193  : \NoUIFactory
194  {
195  $bar_state_factory = new I\Progress\State\Bar\Factory();
196 
197  $state_factory = $this->createMock(C\Progress\State\Factory::class);
198  $state_factory->method('bar')->willReturn($bar_state_factory);
199 
200  $progress_factory = $this->createMock(C\Progress\Factory::class);
201  $progress_factory->method('state')->willReturn($state_factory);
202 
203  return new class ($progress_factory) extends \NoUIFactory {
204  public function __construct(
205  protected C\Progress\Factory $progress_factory,
206  ) {
207  }
208  public function progress(): C\Progress\Factory
209  {
210  return $this->progress_factory;
211  }
212  };
213  }
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\BarStateTest::setUp ( )
protected

Definition at line 38 of file BarStateTest.php.

References Component\Progress\BarStateTest\$determinate_status_value, Component\Progress\BarStateTest\$indeterminate_status_value, Component\Progress\BarStateTest\$message, ILIAS\UI\Implementation\Component\Progress\State\Bar\FAILURE, and Component\Progress\BarStateTest\getUIFactory().

38  : void
39  {
40  $this->indeterminate_status_value = I\Progress\State\Bar\Status::INDETERMINATE->value;
41  $this->determinate_status_value = I\Progress\State\Bar\Status::DETERMINATE->value;
42  $this->success_status_value = I\Progress\State\Bar\Status::SUCCESS->value;
43  $this->failure_status_value = I\Progress\State\Bar\Status::FAILURE->value;
44  $this->message = sha1('progress_bar_state_message');
45 
46  parent::setUp();
47  }
The progress of the process/task cannot be calculated (yet), but it has started processing.
Definition: Status.php:41
+ Here is the call graph for this function:

◆ testDeterminateConstructionWithMaximumValue()

Component\Progress\BarStateTest::testDeterminateConstructionWithMaximumValue ( )

Definition at line 77 of file BarStateTest.php.

References Component\Progress\BarStateTest\$failure_status_value, Component\Progress\BarStateTest\$message, Component\Progress\BarStateTest\$success_status_value, and Component\Progress\BarStateTest\getUIFactory().

77  : void
78  {
79  $invalid_progress = 100;
80  $this->expectException(\InvalidArgumentException::class);
81  $determinate = $this->getUIFactory()->progress()->state()->bar()->determinate($invalid_progress);
82  }
+ Here is the call graph for this function:

◆ testDeterminateConstructionWithNegativeNumber()

Component\Progress\BarStateTest::testDeterminateConstructionWithNegativeNumber ( )

Definition at line 70 of file BarStateTest.php.

References Component\Progress\BarStateTest\getUIFactory().

70  : void
71  {
72  $invalid_progress = -1;
73  $this->expectException(\InvalidArgumentException::class);
74  $determinate = $this->getUIFactory()->progress()->state()->bar()->determinate($invalid_progress);
75  }
+ Here is the call graph for this function:

◆ testRenderDeterminate()

Component\Progress\BarStateTest::testRenderDeterminate ( )

Definition at line 126 of file BarStateTest.php.

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

126  : void
127  {
128  $progress = 55;
129  $state = $this->getUIFactory()->progress()->state()->bar()->determinate($progress, $this->message);
130 
131  $renderer = $this->getDefaultRenderer();
132 
133  $actual_html = $renderer->render($state);
134 
135  $expected_html = <<<EOT
136 <div class="c-progress c-progress-bar--state">
137  <section data-section="progress"><progress value="$progress" max="100"></progress></section>
138  <section data-section="status" data-status="$this->determinate_status_value"></section>
139  <section data-section="message">$this->message</section>
140 </div>
141 EOT;
142 
143  $this->assertEquals(
144  $this->brutallyTrimHTML($expected_html),
145  $this->brutallyTrimHTML($actual_html),
146  );
147  }
$renderer
+ Here is the call graph for this function:

◆ testRenderFailure()

Component\Progress\BarStateTest::testRenderFailure ( )

Definition at line 171 of file BarStateTest.php.

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

171  : void
172  {
173  $state = $this->getUIFactory()->progress()->state()->bar()->failure($this->message);
174 
175  $renderer = $this->getDefaultRenderer();
176 
177  $actual_html = $renderer->render($state);
178 
179  $expected_html = <<<EOT
180 <div class="c-progress c-progress-bar--state">
181  <section data-section="progress"><progress value="100" max="100"></progress></section>
182  <section data-section="status" data-status="$this->failure_status_value"></section>
183  <section data-section="message">$this->message</section>
184 </div>
185 EOT;
186 
187  $this->assertEquals(
188  $this->brutallyTrimHTML($expected_html),
189  $this->brutallyTrimHTML($actual_html),
190  );
191  }
$renderer
+ Here is the call graph for this function:

◆ testRenderIndeterminate()

Component\Progress\BarStateTest::testRenderIndeterminate ( )

Definition at line 104 of file BarStateTest.php.

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

104  : void
105  {
106  $state = $this->getUIFactory()->progress()->state()->bar()->indeterminate($this->message);
107 
108  $renderer = $this->getDefaultRenderer();
109 
110  $actual_html = $renderer->render($state);
111 
112  $expected_html = <<<EOT
113 <div class="c-progress c-progress-bar--state">
114  <section data-section="progress"><progress max="100"></progress></section>
115  <section data-section="status" data-status="$this->indeterminate_status_value"></section>
116  <section data-section="message">$this->message</section>
117 </div>
118 EOT;
119 
120  $this->assertEquals(
121  $this->brutallyTrimHTML($expected_html),
122  $this->brutallyTrimHTML($actual_html),
123  );
124  }
$renderer
+ Here is the call graph for this function:

◆ testRenderSuccess()

Component\Progress\BarStateTest::testRenderSuccess ( )

Definition at line 149 of file BarStateTest.php.

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

149  : void
150  {
151  $state = $this->getUIFactory()->progress()->state()->bar()->success($this->message);
152 
153  $renderer = $this->getDefaultRenderer();
154 
155  $actual_html = $renderer->render($state);
156 
157  $expected_html = <<<EOT
158 <div class="c-progress c-progress-bar--state">
159  <section data-section="progress"><progress value="100" max="100"></progress></section>
160  <section data-section="status" data-status="$this->success_status_value"></section>
161  <section data-section="message">$this->message</section>
162 </div>
163 EOT;
164 
165  $this->assertEquals(
166  $this->brutallyTrimHTML($expected_html),
167  $this->brutallyTrimHTML($actual_html),
168  );
169  }
$renderer
+ Here is the call graph for this function:

Field Documentation

◆ $determinate_status_value

string Component\Progress\BarStateTest::$determinate_status_value
protected

Definition at line 33 of file BarStateTest.php.

Referenced by Component\Progress\BarStateTest\setUp().

◆ $failure_status_value

string Component\Progress\BarStateTest::$failure_status_value
protected

◆ $indeterminate_status_value

string Component\Progress\BarStateTest::$indeterminate_status_value
protected

Definition at line 32 of file BarStateTest.php.

Referenced by Component\Progress\BarStateTest\setUp().

◆ $message

string Component\Progress\BarStateTest::$message
protected

◆ $success_status_value

string Component\Progress\BarStateTest::$success_status_value
protected

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