ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
35 $ilSetting->delete('IL_PHPUNIT_TEST_TIME');
36 $ilSetting->delete('IL_PHPUNIT_TEST_MICROTIME');
37 }
38 }
39
41 {
42 // Act
43 $node = new ilPluginNode($this->workflow);
44
45 // Assert
46 // No exception - good
47 $this->assertTrue(
48 true,
49 'Construction failed with valid context passed to constructor.'
50 );
51 }
52
53 public function testGetContext()
54 {
55 // Arrange
56 $node = new ilPluginNode($this->workflow);
57
58 // Act
59 $actual = $node->getContext();
60
61 // Assert
62 if ($actual === $this->workflow)
63 {
64 $this->assertEquals($actual, $this->workflow);
65 } else {
66 $this->assertTrue(false, 'Context not identical.');
67 }
68 }
69
70 public function testIsActiveAndActivate()
71 {
72 // Arrange
73 $node = new ilPluginNode($this->workflow);
74 require_once './Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
75 $detector = new ilSimpleDetector($node);
76 $node->addDetector($detector);
77
78 // Act
79 $node->activate();
80
81 // Assert
82 $actual = $node->isActive();
83 $this->assertTrue($actual);
84 }
85
86 public function testDeactivate()
87 {
88 // Arrange
89 $node = new ilPluginNode($this->workflow);
90 require_once './Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
91 $detector = new ilSimpleDetector($node);
92 $node->addDetector($detector);
93
94 // Act
95 $node->activate();
96
97 // Assert
98 $this->assertTrue($node->isActive(), 'Node should be active but is inactive.');
99 $node->deactivate();
100 $this->assertFalse($node->isActive(), 'Node should be inactive but is active.');
101 }
102
103}
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