ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
28  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
29  //ilUnitUtil::performInitialisation();
30  }
31  catch ( Exception $exception )
32  {
33  if (!defined('IL_PHPUNIT_TEST'))
34  {
35  define('IL_PHPUNIT_TEST', FALSE);
36  }
37  }
38 
39  // Empty workflow.
40  require_once './Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
41  $this->workflow = new ilEmptyWorkflow();
42 
43  // Basic node
44  require_once './Services/WorkflowEngine/classes/nodes/class.ilBasicNode.php';
45  $this->node = new ilBasicNode($this->workflow);
46 
47  // Wiring up so the node is attached to the workflow.
48  $this->workflow->addNode($this->node);
49 
50  require_once './Services/WorkflowEngine/classes/activities/class.ilScriptActivity.php';
51 
52  $this->test_dir = vfs\vfsStream::setup('example');
53  }
PhpIncludeInspection
PhpIncludeInspection
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

◆ tearDown()

ilScriptActivityTest::tearDown ( )

Definition at line 55 of file ilScriptActivityTest.php.

References $ilSetting.

56  {
57  global $ilSetting;
58  if ($ilSetting != NULL)
59  {
60  //$ilSetting->delete('IL_PHPUNIT_TEST_TIME');
61  //$ilSetting->delete('IL_PHPUNIT_TEST_MICROTIME');
62  }
63  }
global $ilSetting
Definition: privfeed.php:17

◆ testConstructorValidContext()

ilScriptActivityTest::testConstructorValidContext ( )

Definition at line 65 of file ilScriptActivityTest.php.

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

◆ testGetContext()

ilScriptActivityTest::testGetContext ( )

Definition at line 78 of file ilScriptActivityTest.php.

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

◆ testSetGetMethod()

ilScriptActivityTest::testSetGetMethod ( )

Definition at line 95 of file ilScriptActivityTest.php.

References $code.

96  {
97  // Arrange
98  $activity = new ilScriptActivity($this->node);
99 
100  $code = "return 'Hallo, Welt!';";
101  $activity->setMethod(create_function(null,$code));
102 
103  // Act
104  $response = $activity->getScript();
105 
106  // Assert
107  $this->assertEquals($response(), "Hallo, Welt!");
108  }
$code
Definition: example_050.php:99
PhpIncludeInspection

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: