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

ilSettingActivityTest is part of the petri net based workflow engine. More...

+ Inheritance diagram for ilSettingActivityTest:
+ Collaboration diagram for ilSettingActivityTest:

Public Member Functions

 setUp ()
 
 tearDown ()
 
 testConstructorValidContext ()
 
 testSetGetSettingName ()
 
 testSetGetSettingValue ()
 
 testSetSetting ()
 
 testExecute ()
 
 testGetContext ()
 

Additional Inherited Members

- Protected Member Functions inherited from ilWorkflowEngineBaseTest
 setGlobalVariable ($name, $value)
 
 setUp ()
 

Detailed Description

ilSettingActivityTest is part of the petri net based workflow engine.

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

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

/

Definition at line 16 of file ilSettingActivityTest.php.

Member Function Documentation

◆ setUp()

ilSettingActivityTest::setUp ( )

Definition at line 18 of file ilSettingActivityTest.php.

18  : void
19  {
20  parent::setUp();
21 
22  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
23  //ilUnitUtil::performInitialisation();
24 
25  // Empty workflow.
26  require_once './Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
27  $this->workflow = new ilEmptyWorkflow();
28 
29  // Basic node
30  require_once './Services/WorkflowEngine/classes/nodes/class.ilBasicNode.php';
31  $this->node = new ilBasicNode($this->workflow);
32 
33  // Wiring up so the node is attached to the workflow.
34  $this->workflow->addNode($this->node);
35 
36  require_once './Services/WorkflowEngine/classes/activities/class.ilSettingActivity.php';
37  }
PhpIncludeInspection
PhpIncludeInspection

◆ tearDown()

ilSettingActivityTest::tearDown ( )

Definition at line 39 of file ilSettingActivityTest.php.

References $DIC.

39  : void
40  {
41  global $DIC;
42 
43  if (isset($DIC['ilSetting'])) {
44  $DIC['ilSetting']->delete('IL_PHPUNIT_TEST_TIME');
45  $DIC['ilSetting']->delete('IL_PHPUNIT_TEST_MICROTIME');
46  }
47  }
$DIC
Definition: xapitoken.php:46

◆ testConstructorValidContext()

ilSettingActivityTest::testConstructorValidContext ( )

Definition at line 49 of file ilSettingActivityTest.php.

50  {
51  // Act
52  $activity = new ilSettingActivity($this->node);
53 
54  // Assert
55  // No exception - good
56  $this->assertTrue(
57  true,
58  'Construction failed with valid context passed to constructor.'
59  );
60  }
PhpIncludeInspection

◆ testExecute()

ilSettingActivityTest::testExecute ( )

Definition at line 109 of file ilSettingActivityTest.php.

References $GLOBALS.

110  {
111  // Arrange
112  $activity = new ilSettingActivity($this->node);
113  $expected_name = 'Ralle';
114  $expected_val = 'OK';
115  $activity->setSetting($expected_name, $expected_val);
116 
117  $ilSetting_mock = $this->createMock('ilSetting', array('set'), array(), '', false);
118 
119  $ilSetting_mock->expects($this->exactly(1))
120  ->method('set')
121  ->with($expected_name, $expected_val);
122 
123  $stashed_real_object = '';
124  if (isset($GLOBALS['DIC']['ilSetting'])) {
125  $stashed_real_object = $GLOBALS['DIC']['ilSetting'];
126  }
127 
128  unset($GLOBALS['DIC']['ilSetting']);
129  $GLOBALS['DIC']['ilSetting'] = $ilSetting_mock;
130 
131  // Act
132  $activity->execute();
133 
134  $GLOBALS['DIC']['ilSetting'] = $stashed_real_object;
135  }
PhpIncludeInspection
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64

◆ testGetContext()

ilSettingActivityTest::testGetContext ( )

Definition at line 137 of file ilSettingActivityTest.php.

138  {
139  // Arrange
140  $activity = new ilSettingActivity($this->node);
141 
142  // Act
143  $actual = $activity->getContext();
144 
145  // Assert
146  if ($actual === $this->node) {
147  $this->assertEquals($actual, $this->node);
148  } else {
149  $this->assertTrue(false, 'Context not identical.');
150  }
151  }
PhpIncludeInspection

◆ testSetGetSettingName()

ilSettingActivityTest::testSetGetSettingName ( )

Definition at line 62 of file ilSettingActivityTest.php.

63  {
64  // Arrange
65  $activity = new ilSettingActivity($this->node);
66 
67  // Act
68  $expected = 'Günther';
69  $activity->setSettingName($expected);
70  $actual = $activity->getSettingName();
71 
72  // Assert
73  $this->assertEquals($actual, $expected);
74  }
PhpIncludeInspection

◆ testSetGetSettingValue()

ilSettingActivityTest::testSetGetSettingValue ( )

Definition at line 76 of file ilSettingActivityTest.php.

77  {
78  // Arrange
79  $activity = new ilSettingActivity($this->node);
80 
81  // Act
82  $expected = 'Günther';
83  $activity->setSettingValue($expected);
84  $actual = $activity->getSettingValue();
85 
86  // Assert
87  $this->assertEquals($actual, $expected);
88  }
PhpIncludeInspection

◆ testSetSetting()

ilSettingActivityTest::testSetSetting ( )

Definition at line 90 of file ilSettingActivityTest.php.

91  {
92  // Arrange
93  $activity = new ilSettingActivity($this->node);
94 
95  // Act
96  $expected_name = 'Ralle';
97  $expected_value = 'OK';
98  $activity->setSetting($expected_name, $expected_value);
99  $actual_name = $activity->getSettingName();
100  $actual_value = $activity->getSettingValue();
101 
102  // Assert
103  $this->assertEquals(
104  $actual_name . $actual_value,
105  $expected_name . $expected_value
106  );
107  }
PhpIncludeInspection

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