ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilStaticMethodCallActivityTest Class Reference

ilStaticMethodCallActivityTest is part of the petri net based workflow engine. More...

+ Inheritance diagram for ilStaticMethodCallActivityTest:
+ Collaboration diagram for ilStaticMethodCallActivityTest:

Public Member Functions

 setUp ()
 
 tearDown ()
 
 testConstructorValidContext ()
 
 testSetGetIncludeFilename ()
 
 testSetGetClassAndMethodName ()
 
 testSetGetParameters ()
 
 testExecute ()
 
 testGetContext ()
 

Static Public Member Functions

static executionTargetMethod ($context, $param)
 

Detailed Description

ilStaticMethodCallActivityTest is part of the petri net based workflow engine.

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

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

/

Definition at line 15 of file ilStaticMethodCallActivityTest.php.

Member Function Documentation

◆ executionTargetMethod()

static ilStaticMethodCallActivityTest::executionTargetMethod (   $context,
  $param 
)
static

Definition at line 118 of file ilStaticMethodCallActivityTest.php.

119 {
120 $parameters = array(
121 'homer' => 'homer', 0 => 'homer',
122 'marge' => 'marge', 1 => 'marge',
123 'bart' => 'bart', 2 => 'bart',
124 'lisa' => 'lisa', 3 => 'lisa',
125 'maggy' => 'maggy', 4 => 'maggy'
126 );
127
128 if ($context == null) {
129 throw new Exception('Something went wrong with the context.');
130 }
131
132 if ($param[0] != $parameters) {
133 throw new Exception('Something went wrong with the parameters.');
134 }
135
136 return true;
137 }
$context
Definition: webdav.php:25

References $context.

◆ setUp()

ilStaticMethodCallActivityTest::setUp ( )

Definition at line 17 of file ilStaticMethodCallActivityTest.php.

18 {
19 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
20 //ilUnitUtil::performInitialisation();
21
22 // Empty workflow.
23 require_once './Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
24 $this->workflow = new ilEmptyWorkflow();
25
26 // Basic node
27 require_once './Services/WorkflowEngine/classes/nodes/class.ilBasicNode.php';
28 $this->node = new ilBasicNode($this->workflow);
29
30 // Wiring up so the node is attached to the workflow.
31 $this->workflow->addNode($this->node);
32
33 require_once './Services/WorkflowEngine/classes/activities/class.ilStaticMethodCallActivity.php';
34 }
@noinspection PhpIncludeInspection
@noinspection PhpIncludeInspection

◆ tearDown()

ilStaticMethodCallActivityTest::tearDown ( )

Definition at line 36 of file ilStaticMethodCallActivityTest.php.

37 {
38 global $ilSetting;
39 if ($ilSetting != null) {
40 $ilSetting->delete('IL_PHPUNIT_TEST_TIME');
41 $ilSetting->delete('IL_PHPUNIT_TEST_MICROTIME');
42 }
43 }
global $ilSetting
Definition: privfeed.php:17

References $ilSetting.

◆ testConstructorValidContext()

ilStaticMethodCallActivityTest::testConstructorValidContext ( )

Definition at line 45 of file ilStaticMethodCallActivityTest.php.

46 {
47 // Act
48 $activity = new ilStaticMethodCallActivity($this->node);
49
50 // Assert
51 // No exception - good
52 $this->assertTrue(
53 true,
54 'Construction failed with valid context passed to constructor.'
55 );
56 }
@noinspection PhpIncludeInspection

◆ testExecute()

ilStaticMethodCallActivityTest::testExecute ( )

Definition at line 100 of file ilStaticMethodCallActivityTest.php.

101 {
102 // Arrange
103 $activity = new ilStaticMethodCallActivity($this->node);
104 $file = 'Services/WorkflowEngine/test/activities/ilStaticMethodCallActivityTest.php';
105 $class_and_method = 'ilStaticMethodCallActivityTest::executionTargetMethod';
106 $parameters = array('homer', 'marge', 'bart', 'lisa', 'maggy');
107
108 // Act
109 $activity->setIncludeFilename($file);
110 $activity->setClassAndMethodName($class_and_method);
111 $activity->setParameters($parameters);
112 $activity->execute();
113
114 // Assert
115 $this->assertTrue(true, 'There dont seem to be problems here.');
116 }

◆ testGetContext()

ilStaticMethodCallActivityTest::testGetContext ( )

Definition at line 139 of file ilStaticMethodCallActivityTest.php.

140 {
141 // Arrange
142 $activity = new ilStaticMethodCallActivity($this->node);
143
144 // Act
145 $actual = $activity->getContext();
146
147 // Assert
148 if ($actual === $this->node) {
149 $this->assertEquals($actual, $this->node);
150 } else {
151 $this->assertTrue(false, 'Context not identical.');
152 }
153 }

◆ testSetGetClassAndMethodName()

ilStaticMethodCallActivityTest::testSetGetClassAndMethodName ( )

Definition at line 72 of file ilStaticMethodCallActivityTest.php.

73 {
74 // Arrange
75 $activity = new ilStaticMethodCallActivity($this->node);
76 $expected = 'ilWorkflowUtils::targetMethod';
77
78 // Act
79 $activity->setClassAndMethodName($expected);
80 $actual = $activity->getClassAndMethodName();
81
82 // Assert
83 $this->assertEquals($actual, $expected);
84 }

◆ testSetGetIncludeFilename()

ilStaticMethodCallActivityTest::testSetGetIncludeFilename ( )

Definition at line 58 of file ilStaticMethodCallActivityTest.php.

59 {
60 // Arrange
61 $activity = new ilStaticMethodCallActivity($this->node);
62 $expected = 'Services/WorkflowEngine/classes/utils/class.ilWorkflowUtils.php';
63
64 // Act
65 $activity->setIncludeFilename($expected);
66 $actual = $activity->getIncludeFilename();
67
68 // Assert
69 $this->assertEquals($actual, $expected);
70 }

◆ testSetGetParameters()

ilStaticMethodCallActivityTest::testSetGetParameters ( )

Definition at line 86 of file ilStaticMethodCallActivityTest.php.

87 {
88 // Arrange
89 $activity = new ilStaticMethodCallActivity($this->node);
90 $expected = array('homer', 'marge', 'bart', 'lisa', 'maggy');
91
92 // Act
93 $activity->setParameters($expected);
94 $actual = $activity->getParameters();
95
96 // Assert
97 $this->assertEquals($actual, $expected);
98 }

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