23 chdir( dirname ( __FILE__ ) );
24 chdir(
'../../../../');
28 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
33 if (!
defined(
'IL_PHPUNIT_TEST'))
35 define(
'IL_PHPUNIT_TEST', FALSE);
40 require_once
'./Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
44 require_once
'./Services/WorkflowEngine/classes/nodes/class.ilBasicNode.php';
48 $this->workflow->addNode($this->node);
50 require_once
'./Services/WorkflowEngine/classes/activities/class.ilLoggingActivity.php';
52 $this->test_dir = vfs\vfsStream::setup(
'example');
58 if ($ilSetting != NULL)
74 'Construction failed with valid context passed to constructor.' 82 $expected =
'./Services/WorkflowEngine/test/testlog.txt';
85 $activity->setLogFile($expected);
86 $actual = $activity->getLogFile();
91 'Valid log file was given, returned value differed.' 102 $expected =
'/dev/ilias_unit_test_log_file_can_be_deleted_safely.txt';
105 $activity->setLogFile($expected);
106 $actual = $activity->getLogFile();
118 $expected =
'./Services/WorkflowEngine/test/malicious.php';
122 $activity->setLogFile($expected);
123 $actual = $activity->getLogFile();
132 $expected =
'Hallo Spencer!';
135 $activity->setLogMessage($expected);
136 $actual = $activity->getLogMessage();
142 'Get/Set corrupted message.' 155 $activity->setLogMessage(null);
156 $actual = $activity->getLogMessage();
170 $activity->setLogMessage(
'');
171 $actual = $activity->getLogMessage();
180 $expected =
"MESSAGE";
183 $activity->setLogLevel($expected);
184 $actual = $activity->getLogLevel();
190 'Get/Set corrupted log level.' 201 $expected =
"guenther";
204 $activity->setLogLevel($expected);
205 $actual = $activity->getLogLevel();
212 $activity->setLogFile(vfs\vfsStream::url(
'example/log.txt'));
213 $activity->setLogLevel(
'MESSAGE');
214 $activity->setLogMessage(
'TEST');
217 $activity->execute();
220 $expected =
' :: MESSAGE :: TEST';
221 $fp = fopen(vfs\vfsStream::url(
'example/log.txt'),
'r');
223 $actual = substr($line, 25, strlen($line)-27);
228 'Logging Activity did not write expected output.' 239 $activity->setLogFile(vfs\vfsStream::url(
'example.txt'));
248 $actual = $activity->getContext();
251 if ($actual === $this->node)
253 $this->assertEquals($actual, $this->node);
255 $this->assertTrue(
false,
'Context not identical.');
testConstructorValidContext()
testSetGetNonWriteableLogFile()
ilWorkflowFilesystemException
$test_dir
vfsStream Test Directory, see setup.
testSetGetNullLogMessage()
ilWorkflowObjectStateException
ilLoggingActivityTest is part of the petri net based workflow engine.
testPassInUnwriteablePath()
ilWorkflowFilesystemException
testSetGetValidLogLevel()
testSetGetIllegalExtensionLogFile()
ilWorkflowObjectStateException
testSetGetEmptyLogMessage()
ilWorkflowObjectStateException
testSetGetInvalidLogLevel()
ilWorkflowObjectStateException
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'