4 require_once
'Services/WorkflowEngine/test/ilWorkflowEngineBaseTest.php';
22 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
26 require_once
'./Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
30 require_once
'./Services/WorkflowEngine/classes/nodes/class.ilBasicNode.php';
34 $this->workflow->addNode($this->node);
36 require_once
'./Services/WorkflowEngine/classes/activities/class.ilSettingActivity.php';
43 if (isset($DIC[
'ilSetting'])) {
44 $DIC[
'ilSetting']->delete(
'IL_PHPUNIT_TEST_TIME');
45 $DIC[
'ilSetting']->delete(
'IL_PHPUNIT_TEST_MICROTIME');
58 'Construction failed with valid context passed to constructor.' 68 $expected =
'Günther';
69 $activity->setSettingName($expected);
70 $actual = $activity->getSettingName();
73 $this->assertEquals($actual, $expected);
82 $expected =
'Günther';
83 $activity->setSettingValue($expected);
84 $actual = $activity->getSettingValue();
87 $this->assertEquals($actual, $expected);
96 $expected_name =
'Ralle';
97 $expected_value =
'OK';
98 $activity->setSetting($expected_name, $expected_value);
99 $actual_name = $activity->getSettingName();
100 $actual_value = $activity->getSettingValue();
104 $actual_name . $actual_value,
105 $expected_name . $expected_value
113 $expected_name =
'Ralle';
114 $expected_val =
'OK';
115 $activity->setSetting($expected_name, $expected_val);
117 $ilSetting_mock = $this->createMock(
'ilSetting', array(
'set'), array(),
'',
false);
119 $ilSetting_mock->expects($this->exactly(1))
121 ->with($expected_name, $expected_val);
123 $stashed_real_object =
'';
124 if (isset(
$GLOBALS[
'DIC'][
'ilSetting'])) {
125 $stashed_real_object =
$GLOBALS[
'DIC'][
'ilSetting'];
128 unset(
$GLOBALS[
'DIC'][
'ilSetting']);
129 $GLOBALS[
'DIC'][
'ilSetting'] = $ilSetting_mock;
132 $activity->execute();
134 $GLOBALS[
'DIC'][
'ilSetting'] = $stashed_real_object;
143 $actual = $activity->getContext();
146 if ($actual === $this->node) {
147 $this->assertEquals($actual, $this->node);
149 $this->assertTrue(
false,
'Context not identical.');
Class ilWorkflowEngineBaseTest.
ilSettingActivityTest is part of the petri net based workflow engine.
testConstructorValidContext()
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']