ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
WorkflowStepTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
21 require_once(__DIR__ . "/../../../../../libs/composer/vendor/autoload.php");
22 require_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 test_implements_factory_interface(): void
41  {
42  $step = $this->f->step('');
43  $this->assertInstanceOf(Workflow\Step::class, $step);
44  }
45 
46  public function test_constructor_params(): 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 test_withStatus(): 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 test_withStatus_wrong_args(): 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 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21
Provides common functionality for UI tests.
Definition: Base.php:298
Workflow Factory $f