ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 31 of file BarStateTest.php.

Member Function Documentation

◆ getUIFactory()

Component\Progress\BarStateTest::getUIFactory ( )

Definition at line 194 of file BarStateTest.php.

195 {
196 $bar_state_factory = new I\Progress\State\Bar\Factory();
197
198 $state_factory = $this->createMock(I\Progress\State\Factory::class);
199 $state_factory->method('bar')->willReturn($bar_state_factory);
200
201 $progress_factory = $this->createMock(I\Progress\Factory::class);
202 $progress_factory->method('state')->willReturn($state_factory);
203
204 return new class ($progress_factory) extends \NoUIFactory {
205 public function __construct(
206 protected I\Progress\Factory $progress_factory,
207 ) {
208 }
209 public function progress(): I\Progress\Factory
210 {
211 return $this->progress_factory;
212 }
213 };
214 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

Referenced by 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().

+ 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 39 of file BarStateTest.php.

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

References ILIAS\UI\Implementation\Component\Progress\State\Bar\FAILURE.

◆ testDeterminateConstructionWithMaximumValue()

Component\Progress\BarStateTest::testDeterminateConstructionWithMaximumValue ( )

Definition at line 78 of file BarStateTest.php.

78 : void
79 {
80 $invalid_progress = 100;
81 $this->expectException(\InvalidArgumentException::class);
82 $determinate = $this->getUIFactory()->progress()->state()->bar()->determinate($invalid_progress);
83 }

References Component\Progress\BarStateTest\getUIFactory().

+ Here is the call graph for this function:

◆ testDeterminateConstructionWithNegativeNumber()

Component\Progress\BarStateTest::testDeterminateConstructionWithNegativeNumber ( )

Definition at line 71 of file BarStateTest.php.

71 : void
72 {
73 $invalid_progress = -1;
74 $this->expectException(\InvalidArgumentException::class);
75 $determinate = $this->getUIFactory()->progress()->state()->bar()->determinate($invalid_progress);
76 }

References Component\Progress\BarStateTest\getUIFactory().

+ Here is the call graph for this function:

◆ testRenderDeterminate()

Component\Progress\BarStateTest::testRenderDeterminate ( )

Definition at line 127 of file BarStateTest.php.

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

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

+ Here is the call graph for this function:

◆ testRenderFailure()

Component\Progress\BarStateTest::testRenderFailure ( )

Definition at line 172 of file BarStateTest.php.

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

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

+ Here is the call graph for this function:

◆ testRenderIndeterminate()

Component\Progress\BarStateTest::testRenderIndeterminate ( )

Definition at line 105 of file BarStateTest.php.

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

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

+ Here is the call graph for this function:

◆ testRenderSuccess()

Component\Progress\BarStateTest::testRenderSuccess ( )

Definition at line 150 of file BarStateTest.php.

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

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

+ Here is the call graph for this function:

Field Documentation

◆ $determinate_status_value

string Component\Progress\BarStateTest::$determinate_status_value
protected

Definition at line 34 of file BarStateTest.php.

◆ $failure_status_value

string Component\Progress\BarStateTest::$failure_status_value
protected

Definition at line 36 of file BarStateTest.php.

◆ $indeterminate_status_value

string Component\Progress\BarStateTest::$indeterminate_status_value
protected

Definition at line 33 of file BarStateTest.php.

◆ $message

string Component\Progress\BarStateTest::$message
protected

Definition at line 37 of file BarStateTest.php.

◆ $success_status_value

string Component\Progress\BarStateTest::$success_status_value
protected

Definition at line 35 of file BarStateTest.php.


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