ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilScriptActivityTest Class Reference

ilScriptActivityTest is part of the workflow engine. More...

+ Inheritance diagram for ilScriptActivityTest:
+ Collaboration diagram for ilScriptActivityTest:

Public Member Functions

 setUp ()
 
 tearDown ()
 
 testConstructorValidContext ()
 
 testGetContext ()
 
 testSetGetMethod ()
 

Data Fields

 $test_dir
 vfsStream Test Directory, see setup. More...
 

Detailed Description

ilScriptActivityTest is part of the workflow engine.

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

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

/

Definition at line 17 of file ilScriptActivityTest.php.

Member Function Documentation

◆ setUp()

ilScriptActivityTest::setUp ( )

Definition at line 22 of file ilScriptActivityTest.php.

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

◆ tearDown()

ilScriptActivityTest::tearDown ( )

Definition at line 52 of file ilScriptActivityTest.php.

References $ilSetting.

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

◆ testConstructorValidContext()

ilScriptActivityTest::testConstructorValidContext ( )

Definition at line 61 of file ilScriptActivityTest.php.

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

◆ testGetContext()

ilScriptActivityTest::testGetContext ( )

Definition at line 74 of file ilScriptActivityTest.php.

75  {
76  // Arrange
77  $activity = new ilScriptActivity($this->node);
78 
79  // Act
80  $actual = $activity->getContext();
81 
82  // Assert
83  if ($actual === $this->node) {
84  $this->assertEquals($actual, $this->node);
85  } else {
86  $this->assertTrue(false, 'Context not identical.');
87  }
88  }
PhpIncludeInspection

◆ testSetGetMethod()

ilScriptActivityTest::testSetGetMethod ( )

Definition at line 90 of file ilScriptActivityTest.php.

References $response.

91  {
92  // Arrange
93  $activity = new ilScriptActivity($this->node);
94 
95  $activity->setMethod(function () {
96  return 'Hallo, Welt!';
97  });
98 
99  // Act
100  $response = $activity->getScript();
101 
102  // Assert
103  $this->assertEquals($response(), "Hallo, Welt!");
104  }
PhpIncludeInspection
$response

Field Documentation

◆ $test_dir

ilScriptActivityTest::$test_dir

vfsStream Test Directory, see setup.

Definition at line 20 of file ilScriptActivityTest.php.


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