ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 16 of file ilScriptActivityTest.php.

Member Function Documentation

◆ setUp()

ilScriptActivityTest::setUp ( )

Definition at line 21 of file ilScriptActivityTest.php.

References defined.

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

◆ tearDown()

ilScriptActivityTest::tearDown ( )

Definition at line 51 of file ilScriptActivityTest.php.

References $ilSetting.

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

◆ testConstructorValidContext()

ilScriptActivityTest::testConstructorValidContext ( )

Definition at line 60 of file ilScriptActivityTest.php.

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

◆ testGetContext()

ilScriptActivityTest::testGetContext ( )

Definition at line 73 of file ilScriptActivityTest.php.

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

◆ testSetGetMethod()

ilScriptActivityTest::testSetGetMethod ( )

Definition at line 89 of file ilScriptActivityTest.php.

References $response.

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

Field Documentation

◆ $test_dir

ilScriptActivityTest::$test_dir

vfsStream Test Directory, see setup.

Definition at line 19 of file ilScriptActivityTest.php.


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