ILIAS  release_7 Revision v7.30-3-g800a261c036
LinearWorkflowTest.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2018 Nils Haagen <nils.haagen@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
5require_once(__DIR__ . "/../../../../../libs/composer/vendor/autoload.php");
6require_once(__DIR__ . "/../../../Base.php");
7
8use \ILIAS\UI\Component\Listing\Workflow;
9
11{
12 protected function buildFactory()
13 {
15 }
16
17 public function setUp() : void
18 {
19 $f = $this->buildFactory();
20 $this->title = 'title';
21 $this->steps = [
22 $f->step('', ''),
23 $f->step('', '')
24 ];
25 $this->wf = $f->linear($this->title, $this->steps);
26 }
27
29 {
30 $this->assertInstanceOf(Workflow\Workflow::class, $this->wf);
31 }
32
33 public function test_constructor_params()
34 {
35 $this->assertEquals($this->title, $this->wf->getTitle());
36 $this->assertEquals($this->steps, $this->wf->getSteps());
37 $this->assertEquals(0, $this->wf->getActive());
38 }
39
40 public function test_constructor()
41 {
42 $this->assertEquals($this->title, $this->wf->getTitle());
43 $this->assertEquals($this->steps, $this->wf->getSteps());
44 $this->assertEquals(0, $this->wf->getActive());
45 }
46
47 public function test_amount_of_steps()
48 {
49 $this->assertEquals(count($this->steps), $this->wf->getAmountOfSteps());
50 }
51
52 public function test_active()
53 {
54 $wf = $this->wf->withActive(1);
55 $this->assertEquals(1, $wf->getActive());
56 }
57
58 public function test_withActive_throws()
59 {
60 $raised = false;
61 try {
62 $this->wf->withActive(-1);
63 $this->assertFalse("This should not happen.");
64 } catch (\InvalidArgumentException $e) {
65 $raised = true;
66 }
67 $this->assertTrue($raised);
68
69 $raised = false;
70 try {
71 $this->wf->withActive(2);
72 $this->assertFalse("This should not happen.");
73 } catch (\InvalidArgumentException $e) {
74 $raised = true;
75 }
76 $this->assertTrue($raised);
77 }
78}
An exception for terminatinating execution or to throw for unit testing.
Provides common functionality for UI tests.
Definition: Base.php:263