ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSimpleEmitterTest Class Reference

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

+ Inheritance diagram for ilSimpleEmitterTest:
+ Collaboration diagram for ilSimpleEmitterTest:

Public Member Functions

 setUp ()
 
 tearDown ()
 
 testConstructorValidContext ()
 
 testGetContext ()
 
 testSetGetTargetDetector ()
 
 testEmitValidState ()
 

Detailed Description

ilSimpleEmitterTest is part of the petri net based workflow engine.

This class holds all tests for the class emitters/class.ilSimpleEmitter

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

/

Definition at line 15 of file ilSimpleEmitterTest.php.

Member Function Documentation

◆ setUp()

ilSimpleEmitterTest::setUp ( )

Definition at line 17 of file ilSimpleEmitterTest.php.

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

◆ tearDown()

ilSimpleEmitterTest::tearDown ( )

Definition at line 36 of file ilSimpleEmitterTest.php.

References $ilSetting.

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

◆ testConstructorValidContext()

ilSimpleEmitterTest::testConstructorValidContext ( )

Definition at line 47 of file ilSimpleEmitterTest.php.

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

◆ testEmitValidState()

ilSimpleEmitterTest::testEmitValidState ( )

Definition at line 95 of file ilSimpleEmitterTest.php.

96  {
97  // Arrange
98  require_once './Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
99  $target_node = new ilBasicNode($this->workflow);
100  $target_detector = new ilSimpleDetector($target_node);
101  $target_node->addDetector($target_detector);
102 
103  $emitter = new ilSimpleEmitter($this->node);
104  $emitter->setTargetDetector($target_detector);
105 
106  // Act
107  $emitter->emit();
108  // Assert
109  $actual = $target_detector->getDetectorState();
110  $this->assertTrue($actual);
111  }
PhpIncludeInspection
PhpIncludeInspection
PhpIncludeInspection

◆ testGetContext()

ilSimpleEmitterTest::testGetContext ( )

Definition at line 60 of file ilSimpleEmitterTest.php.

61  {
62  // Arrange
63  $emitter = new ilSimpleEmitter($this->node);
64 
65  // Act
66  $actual = $emitter->getContext();
67 
68  // Assert
69  if ($actual === $this->node)
70  {
71  $this->assertEquals($actual, $this->node);
72  } else {
73  $this->assertTrue(false, 'Context not identical.');
74  }
75  }
PhpIncludeInspection

◆ testSetGetTargetDetector()

ilSimpleEmitterTest::testSetGetTargetDetector ( )

Definition at line 77 of file ilSimpleEmitterTest.php.

78  {
79  // Arrange
80  require_once './Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
81  $target_node = new ilBasicNode($this->workflow);
82  $target_detector = new ilSimpleDetector($target_node);
83  $target_node->addDetector($target_detector);
84 
85  $emitter = new ilSimpleEmitter($this->node);
86 
87  // Act
88  $emitter->setTargetDetector($target_detector);
89 
90  // Assert
91  $actual = $emitter->getTargetDetector();
92  $this->assertEquals($target_detector, $actual);
93  }
PhpIncludeInspection
PhpIncludeInspection
PhpIncludeInspection

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