ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
LinearWorkflowTest Class Reference
+ Inheritance diagram for LinearWorkflowTest:
+ Collaboration diagram for LinearWorkflowTest:

Public Member Functions

 setUp ()
 
 testImplementsFactoryInterface ()
 
 testConstructorParams ()
 
 testConstructor ()
 
 testAmountOfSteps ()
 
 testActive ()
 
 testWithActiveThrows ()
 
 testLinearWorkflowRendering ()
 

Protected Member Functions

 buildFactory ()
 

Protected Attributes

string $title
 
array $steps
 
Workflow Linear $wf
 

Detailed Description

Definition at line 26 of file LinearWorkflowTest.php.

Member Function Documentation

◆ buildFactory()

LinearWorkflowTest::buildFactory ( )
protected

Definition at line 32 of file LinearWorkflowTest.php.

Referenced by setUp().

+ Here is the caller graph for this function:

◆ setUp()

LinearWorkflowTest::setUp ( )

Definition at line 37 of file LinearWorkflowTest.php.

37 : void
38 {
39 $f = $this->buildFactory();
40 $this->title = 'title';
41 $this->steps = [
42 $f->step(''),
43 $f->step('')
44 ];
45 $this->wf = $f->linear($this->title, $this->steps);
46 }

References Vendor\Package\$f, and buildFactory().

+ Here is the call graph for this function:

◆ testActive()

LinearWorkflowTest::testActive ( )

Definition at line 72 of file LinearWorkflowTest.php.

72 : void
73 {
74 $wf = $this->wf->withActive(1);
75 $this->assertEquals(1, $wf->getActive());
76 }
withActive(int $active)
The step at this position is set to active.
getActive()
This is the index of the active step.

References $wf, ILIAS\UI\Component\Listing\Workflow\Workflow\getActive(), and ILIAS\UI\Component\Listing\Workflow\Workflow\withActive().

+ Here is the call graph for this function:

◆ testAmountOfSteps()

LinearWorkflowTest::testAmountOfSteps ( )

Definition at line 67 of file LinearWorkflowTest.php.

67 : void
68 {
69 $this->assertEquals(count($this->steps), $this->wf->getAmountOfSteps());
70 }

◆ testConstructor()

LinearWorkflowTest::testConstructor ( )

Definition at line 60 of file LinearWorkflowTest.php.

60 : void
61 {
62 $this->assertEquals($this->title, $this->wf->getTitle());
63 $this->assertEquals($this->steps, $this->wf->getSteps());
64 $this->assertEquals(0, $this->wf->getActive());
65 }

◆ testConstructorParams()

LinearWorkflowTest::testConstructorParams ( )

Definition at line 53 of file LinearWorkflowTest.php.

53 : void
54 {
55 $this->assertEquals($this->title, $this->wf->getTitle());
56 $this->assertEquals($this->steps, $this->wf->getSteps());
57 $this->assertEquals(0, $this->wf->getActive());
58 }

◆ testImplementsFactoryInterface()

LinearWorkflowTest::testImplementsFactoryInterface ( )

Definition at line 48 of file LinearWorkflowTest.php.

48 : void
49 {
50 $this->assertInstanceOf(Workflow\Workflow::class, $this->wf);
51 }

◆ testLinearWorkflowRendering()

LinearWorkflowTest::testLinearWorkflowRendering ( )

Definition at line 99 of file LinearWorkflowTest.php.

99 : void
100 {
101 $expected = <<<EOT
102 <div class="il-workflow linear" id="id_1">
103 <div class="il-workflow-header">
104 <h3 class="il-workflow-title">title</h3>
105 </div>
106 <ul class="il-workflow-container">
107 <li class="il-workflow-step first available not-started">
108 <div class="text">
109 <span class="il-workflow-step-label"></span>
110 <span class="il-workflow-step-description"></span>
111 </div>
112 </li>
113 <li class="il-workflow-step last active not-started">
114 <div class="text">
115 <span class="il-workflow-step-label"></span>
116 <span class="il-workflow-step-description"></span>
117 </div>
118 </li>
119 </ul>
120 </div>
121EOT;
122 $actual = $this->getDefaultRenderer()->render($wf = $this->wf->withActive(1));
123 $this->assertEquals(
124 $this->brutallyTrimHTML($expected),
125 $this->brutallyTrimHTML($actual),
126 );
127 }

References $wf, and ILIAS\UI\Component\Listing\Workflow\Workflow\withActive().

+ Here is the call graph for this function:

◆ testWithActiveThrows()

LinearWorkflowTest::testWithActiveThrows ( )

Definition at line 78 of file LinearWorkflowTest.php.

78 : void
79 {
80 $raised = false;
81 try {
82 $this->wf->withActive(-1);
83 $this->assertFalse("This should not happen.");
84 } catch (InvalidArgumentException $e) {
85 $raised = true;
86 }
87 $this->assertTrue($raised);
88
89 $raised = false;
90 try {
91 $this->wf->withActive(2);
92 $this->assertFalse("This should not happen.");
93 } catch (InvalidArgumentException $e) {
94 $raised = true;
95 }
96 $this->assertTrue($raised);
97 }

References Vendor\Package\$e.

Field Documentation

◆ $steps

array LinearWorkflowTest::$steps
protected

Definition at line 29 of file LinearWorkflowTest.php.

◆ $title

string LinearWorkflowTest::$title
protected

Definition at line 28 of file LinearWorkflowTest.php.

◆ $wf

Workflow Linear LinearWorkflowTest::$wf
protected

Definition at line 30 of file LinearWorkflowTest.php.

Referenced by testActive(), and testLinearWorkflowRendering().


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