23 chdir(dirname(__FILE__));
24 chdir(
'../../../../');
27 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
30 if (!
defined(
'IL_PHPUNIT_TEST')) {
31 define(
'IL_PHPUNIT_TEST',
false);
36 require_once
'./Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
40 require_once
'./Services/WorkflowEngine/classes/nodes/class.ilBasicNode.php';
44 $this->workflow->addNode($this->node);
46 require_once
'./Services/WorkflowEngine/classes/activities/class.ilLoggingActivity.php';
48 $this->test_dir = vfs\vfsStream::setup(
'example');
54 if ($ilSetting != null) {
69 'Construction failed with valid context passed to constructor.' 77 $expected =
'./Services/WorkflowEngine/test/testlog.txt';
80 $activity->setLogFile($expected);
81 $actual = $activity->getLogFile();
86 'Valid log file was given, returned value differed.' 97 $expected =
'/dev/ilias_unit_test_log_file_can_be_deleted_safely.txt';
100 $activity->setLogFile($expected);
101 $actual = $activity->getLogFile();
113 $expected =
'./Services/WorkflowEngine/test/malicious.php';
117 $activity->setLogFile($expected);
118 $actual = $activity->getLogFile();
127 $expected =
'Hallo Spencer!';
130 $activity->setLogMessage($expected);
131 $actual = $activity->getLogMessage();
137 'Get/Set corrupted message.' 150 $activity->setLogMessage(null);
151 $actual = $activity->getLogMessage();
165 $activity->setLogMessage(
'');
166 $actual = $activity->getLogMessage();
175 $expected =
"MESSAGE";
178 $activity->setLogLevel($expected);
179 $actual = $activity->getLogLevel();
185 'Get/Set corrupted log level.' 196 $expected =
"guenther";
199 $activity->setLogLevel($expected);
200 $actual = $activity->getLogLevel();
207 $activity->setLogFile(vfs\vfsStream::url(
'example/log.txt'));
208 $activity->setLogLevel(
'MESSAGE');
209 $activity->setLogMessage(
'TEST');
212 $activity->execute();
215 $expected =
' :: MESSAGE :: TEST';
216 $fp = fopen(vfs\vfsStream::url(
'example/log.txt'),
'r');
218 $actual = substr($line, 25, strlen($line)-27);
223 'Logging Activity did not write expected output.' 234 $activity->setLogFile(vfs\vfsStream::url(
'example.txt'));
243 $actual = $activity->getContext();
246 if ($actual === $this->node) {
247 $this->assertEquals($actual, $this->node);
249 $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'