ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
WorkflowStepTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21require_once(__DIR__ . "/../../../../../../../vendor/composer/vendor/autoload.php");
22require_once(__DIR__ . "/../../../Base.php");
23
25
27{
28 protected Workflow\Factory $f;
29
30 protected function buildFactory(): Workflow\Factory
31 {
33 }
34
35 public function setUp(): void
36 {
37 $this->f = $this->buildFactory();
38 }
39
40 public function testImplementsFactoryInterface(): void
41 {
42 $step = $this->f->step('');
43 $this->assertInstanceOf(Workflow\Step::class, $step);
44 }
45
46 public function testConstructorParams(): void
47 {
48 $label = 'label';
49 $description = 'description';
50 $step = $this->f->step($label, $description);
51 $this->assertEquals($label, $step->getLabel());
52 $this->assertEquals($description, $step->getDescription());
53 $this->assertEquals(Workflow\Step::NOT_STARTED, $step->getStatus());
54 }
55
56 public function testWithStatus(): void
57 {
58 $status = Workflow\Step::SUCCESSFULLY;
59 $step = $this->f->step('')->withStatus($status);
60 $this->assertEquals($status, $step->getStatus());
61 }
62
63 public function testWithStatusWrongArgs(): void
64 {
65 $status = 100;
66 $raised = false;
67 try {
68 $this->f->step('')->withStatus($status);
69 } catch (InvalidArgumentException $e) {
70 $raised = true;
71 }
72 $this->assertTrue($raised);
73 }
74}
Provides common functionality for UI tests.
Definition: Base.php:337
Workflow Factory $f
This is the interface for a workflow factory.
Definition: Factory.php:29