ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 16 of file ilEventRaisingActivityTest.php.

Member Function Documentation

◆ setUp()

ilEventRaisingActivityTest::setUp ( )

Definition at line 21 of file ilEventRaisingActivityTest.php.

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

◆ tearDown()

ilEventRaisingActivityTest::tearDown ( )

Definition at line 51 of file ilEventRaisingActivityTest.php.

References $ilSetting.

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

◆ testConstructorValidContext()

ilEventRaisingActivityTest::testConstructorValidContext ( )

Definition at line 60 of file ilEventRaisingActivityTest.php.

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

◆ testGetContext()

ilEventRaisingActivityTest::testGetContext ( )

Definition at line 107 of file ilEventRaisingActivityTest.php.

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

◆ testSetGetEventNameShouldReturnSetValue()

ilEventRaisingActivityTest::testSetGetEventNameShouldReturnSetValue ( )

Definition at line 73 of file ilEventRaisingActivityTest.php.

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

◆ testSetGetEventTypeShouldReturnSetValue()

ilEventRaisingActivityTest::testSetGetEventTypeShouldReturnSetValue ( )

Definition at line 90 of file ilEventRaisingActivityTest.php.

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

◆ testSetGetFixedParamsMultiplePairs()

ilEventRaisingActivityTest::testSetGetFixedParamsMultiplePairs ( )

Definition at line 140 of file ilEventRaisingActivityTest.php.

References PHPMailer\PHPMailer\$params.

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

◆ testSetGetFixedParamsSinglePair()

ilEventRaisingActivityTest::testSetGetFixedParamsSinglePair ( )

Definition at line 123 of file ilEventRaisingActivityTest.php.

References $key, and PHPMailer\PHPMailer\$params.

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

Field Documentation

◆ $test_dir

ilEventRaisingActivityTest::$test_dir

vfsStream Test Directory, see setup.

Definition at line 19 of file ilEventRaisingActivityTest.php.


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