ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilPluginNodeTest.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
3
16{
18 public $workflow;
19
20 public function setUp()
21 {
22 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
23 //ilUnitUtil::performInitialisation();
24
25 // Empty workflow.
26 require_once './Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
27 $this->workflow = new ilEmptyWorkflow();
28 }
29
30 public function tearDown()
31 {
32 global $ilSetting;
33 if ($ilSetting != null) {
34 $ilSetting->delete('IL_PHPUNIT_TEST_TIME');
35 $ilSetting->delete('IL_PHPUNIT_TEST_MICROTIME');
36 }
37 }
38
40 {
41 // Act
42 $node = new ilPluginNode($this->workflow);
43
44 // Assert
45 // No exception - good
46 $this->assertTrue(
47 true,
48 'Construction failed with valid context passed to constructor.'
49 );
50 }
51
52 public function testGetContext()
53 {
54 // Arrange
55 $node = new ilPluginNode($this->workflow);
56
57 // Act
58 $actual = $node->getContext();
59
60 // Assert
61 if ($actual === $this->workflow) {
62 $this->assertEquals($actual, $this->workflow);
63 } else {
64 $this->assertTrue(false, 'Context not identical.');
65 }
66 }
67
68 public function testIsActiveAndActivate()
69 {
70 // Arrange
71 $node = new ilPluginNode($this->workflow);
72 require_once './Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
73 $detector = new ilSimpleDetector($node);
74 $node->addDetector($detector);
75
76 // Act
77 $node->activate();
78
79 // Assert
80 $actual = $node->isActive();
81 $this->assertTrue($actual);
82 }
83
84 public function testDeactivate()
85 {
86 // Arrange
87 $node = new ilPluginNode($this->workflow);
88 require_once './Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
89 $detector = new ilSimpleDetector($node);
90 $node->addDetector($detector);
91
92 // Act
93 $node->activate();
94
95 // Assert
96 $this->assertTrue($node->isActive(), 'Node should be active but is inactive.');
97 $node->deactivate();
98 $this->assertFalse($node->isActive(), 'Node should be inactive but is active.');
99 }
100}
An exception for terminatinating execution or to throw for unit testing.
@noinspection PhpIncludeInspection
ilPluginNodeTest is part of the petri net based workflow engine.
@noinspection PhpIncludeInspection
@noinspection PhpIncludeInspection
global $ilSetting
Definition: privfeed.php:17