ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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.

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 $ilSetting.

40  {
41  global $ilSetting;
42  if ($ilSetting != null) {
43  $ilSetting->delete('IL_PHPUNIT_TEST_TIME');
44  $ilSetting->delete('IL_PHPUNIT_TEST_MICROTIME');
45  }
46  }
global $ilSetting
Definition: privfeed.php:17

◆ testConstructorValidContext()

ilSettingActivityTest::testConstructorValidContext ( )

Definition at line 48 of file ilSettingActivityTest.php.

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

◆ testExecute()

ilSettingActivityTest::testExecute ( )

Definition at line 108 of file ilSettingActivityTest.php.

References $GLOBALS, and array.

109  {
110  // Arrange
111  $activity = new ilSettingActivity($this->node);
112  $expected_name = 'Ralle';
113  $expected_val = 'OK';
114  $activity->setSetting($expected_name, $expected_val);
115 
116  require_once './Services/Administration/classes/class.ilSetting.php';
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  $stashed_real_object = @$GLOBALS['ilSetting'];
123  $GLOBALS['ilSetting'] = $ilSetting_mock;
124 
125  // Act
126  $activity->execute();
127 
128  $GLOBALS['ilSetting'] = $stashed_real_object;
129  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
PhpIncludeInspection
Create styles array
The data for the language used.

◆ testGetContext()

ilSettingActivityTest::testGetContext ( )

Definition at line 131 of file ilSettingActivityTest.php.

132  {
133  // Arrange
134  $activity = new ilSettingActivity($this->node);
135 
136  // Act
137  $actual = $activity->getContext();
138 
139  // Assert
140  if ($actual === $this->node) {
141  $this->assertEquals($actual, $this->node);
142  } else {
143  $this->assertTrue(false, 'Context not identical.');
144  }
145  }
PhpIncludeInspection

◆ testSetGetSettingName()

ilSettingActivityTest::testSetGetSettingName ( )

Definition at line 61 of file ilSettingActivityTest.php.

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

◆ testSetGetSettingValue()

ilSettingActivityTest::testSetGetSettingValue ( )

Definition at line 75 of file ilSettingActivityTest.php.

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

◆ testSetSetting()

ilSettingActivityTest::testSetSetting ( )

Definition at line 89 of file ilSettingActivityTest.php.

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

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