ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilEventRaisingActivityTest Class Reference

ilEventRaisingActivityTest is part of the workflow engine. More...

+ Inheritance diagram for ilEventRaisingActivityTest:
+ Collaboration diagram for ilEventRaisingActivityTest:

Public Member Functions

 setUp ()
 
 tearDown ()
 
 testConstructorValidContext ()
 
 testSetGetEventNameShouldReturnSetValue ()
 
 testSetGetEventTypeShouldReturnSetValue ()
 
 testGetContext ()
 
 testSetGetFixedParamsSinglePair ()
 
 testSetGetFixedParamsMultiplePairs ()
 

Data Fields

 $test_dir
 vfsStream Test Directory, see setup. More...
 

Detailed Description

ilEventRaisingActivityTest is part of the workflow engine.

This class holds all tests for the class activities/class.ilEventRaisingActivity

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

/

Definition at line 17 of file ilEventRaisingActivityTest.php.

Member Function Documentation

◆ setUp()

ilEventRaisingActivityTest::setUp ( )

Definition at line 22 of file ilEventRaisingActivityTest.php.

22 : void
23 {
24 chdir(dirname(__FILE__));
25 chdir('../../../../');
26
27 try {
28 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
29 //ilUnitUtil::performInitialisation();
30 } catch (Exception $exception) {
31 if (!defined('IL_PHPUNIT_TEST')) {
32 define('IL_PHPUNIT_TEST', false);
33 }
34 }
35
36 // Empty workflow.
37 require_once './Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
38 $this->workflow = new ilEmptyWorkflow();
39
40 // Basic node
41 require_once './Services/WorkflowEngine/classes/nodes/class.ilBasicNode.php';
42 $this->node = new ilBasicNode($this->workflow);
43
44 // Wiring up so the node is attached to the workflow.
45 $this->workflow->addNode($this->node);
46
47 require_once './Services/WorkflowEngine/classes/activities/class.ilEventRaisingActivity.php';
48
49 $this->test_dir = vfs\vfsStream::setup('example');
50 }
@noinspection PhpIncludeInspection
@noinspection PhpIncludeInspection

◆ tearDown()

ilEventRaisingActivityTest::tearDown ( )

Definition at line 52 of file ilEventRaisingActivityTest.php.

52 : void
53 {
54 global $ilSetting;
55 if ($ilSetting != null) {
56 //$ilSetting->delete('IL_PHPUNIT_TEST_TIME');
57 //$ilSetting->delete('IL_PHPUNIT_TEST_MICROTIME');
58 }
59 }
global $ilSetting
Definition: privfeed.php:17

References $ilSetting.

◆ testConstructorValidContext()

ilEventRaisingActivityTest::testConstructorValidContext ( )

Definition at line 61 of file ilEventRaisingActivityTest.php.

62 {
63 // Act
64 $activity = new ilEventRaisingActivity($this->node);
65
66 // Assert
67 // No exception - good
68 $this->assertTrue(
69 true,
70 'Construction failed with valid context passed to constructor.'
71 );
72 }
@noinspection PhpIncludeInspection

◆ testGetContext()

ilEventRaisingActivityTest::testGetContext ( )

Definition at line 108 of file ilEventRaisingActivityTest.php.

109 {
110 // Arrange
111 $activity = new ilEventRaisingActivity($this->node);
112
113 // Act
114 $actual = $activity->getContext();
115
116 // Assert
117 if ($actual === $this->node) {
118 $this->assertEquals($actual, $this->node);
119 } else {
120 $this->assertTrue(false, 'Context not identical.');
121 }
122 }

◆ testSetGetEventNameShouldReturnSetValue()

ilEventRaisingActivityTest::testSetGetEventNameShouldReturnSetValue ( )

Definition at line 74 of file ilEventRaisingActivityTest.php.

75 {
76 // Arrange
77 $activity = new ilEventRaisingActivity($this->node);
78 $expected = 'HokusPokus';
79
80 // Act
81 $activity->setEventName($expected);
82 $actual = $activity->getEventName();
83
84 $this->assertEquals(
85 $actual,
86 $expected,
87 'Retrieved EventName differs from input value.'
88 );
89 }

◆ testSetGetEventTypeShouldReturnSetValue()

ilEventRaisingActivityTest::testSetGetEventTypeShouldReturnSetValue ( )

Definition at line 91 of file ilEventRaisingActivityTest.php.

92 {
93 // Arrange
94 $activity = new ilEventRaisingActivity($this->node);
95 $expected = 'HokusPokus';
96
97 // Act
98 $activity->setEventType($expected);
99 $actual = $activity->getEventType();
100
101 $this->assertEquals(
102 $actual,
103 $expected,
104 'Retrieved EventType differs from input value.'
105 );
106 }

◆ testSetGetFixedParamsMultiplePairs()

ilEventRaisingActivityTest::testSetGetFixedParamsMultiplePairs ( )

Definition at line 141 of file ilEventRaisingActivityTest.php.

142 {
143 // Arrange
144 $activity = new ilEventRaisingActivity($this->node);
145 $key1 = 'Key1';
146 $value1 = 123;
147 $key2 = 'Key2';
148 $value2 = 234;
149 $key3 = 'Key3';
150 $value3 = 345;
151 $expected[] = array('key' => $key1, 'value' => $value1);
152 $expected[] = array('key' => $key2, 'value' => $value2);
153 $expected[] = array('key' => $key3, 'value' => $value3);
154 $expected[] = array('key' => 'context', 'value' => $activity);
155
156 // Act
157 $activity->addFixedParam($key1, $value1);
158 $activity->addFixedParam($key2, $value2);
159 $activity->addFixedParam($key3, $value3);
160 $params = $activity->getParamsArray();
161
162 // Assert
163 $this->assertEquals($expected, $params);
164 }

◆ testSetGetFixedParamsSinglePair()

ilEventRaisingActivityTest::testSetGetFixedParamsSinglePair ( )

Definition at line 124 of file ilEventRaisingActivityTest.php.

125 {
126 // Arrange
127 $activity = new ilEventRaisingActivity($this->node);
128 $key = 'Key';
129 $value = 123;
130 $expected[] = array('key' => $key, 'value' => $value);
131 $expected[] = array('key' => 'context', 'value' => $activity);
132
133 // Act
134 $activity->addFixedParam($key, $value);
135 $params = $activity->getParamsArray();
136
137 // Assert
138 $this->assertEquals($expected, $params);
139 }

Field Documentation

◆ $test_dir

ilEventRaisingActivityTest::$test_dir

vfsStream Test Directory, see setup.

Definition at line 20 of file ilEventRaisingActivityTest.php.


The documentation for this class was generated from the following file: