ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilDataEmitterTest Class Reference

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

+ Inheritance diagram for ilDataEmitterTest:
+ Collaboration diagram for ilDataEmitterTest:

Public Member Functions

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

Detailed Description

ilDataEmitterTest is part of the petri net based workflow engine.

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

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

/

Definition at line 15 of file ilDataEmitterTest.php.

Member Function Documentation

◆ setUp()

ilDataEmitterTest::setUp ( )

Definition at line 17 of file ilDataEmitterTest.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.ilDataEmitter.php';
34  }
PhpIncludeInspection
PhpIncludeInspection

◆ tearDown()

ilDataEmitterTest::tearDown ( )

Definition at line 36 of file ilDataEmitterTest.php.

References $ilSetting.

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

◆ testConstructorValidContext()

ilDataEmitterTest::testConstructorValidContext ( )

Definition at line 45 of file ilDataEmitterTest.php.

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

◆ testEmitValidState()

ilDataEmitterTest::testEmitValidState ( )

Definition at line 92 of file ilDataEmitterTest.php.

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

◆ testGetContext()

ilDataEmitterTest::testGetContext ( )

Definition at line 58 of file ilDataEmitterTest.php.

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

◆ testSetGetTargetDetector()

ilDataEmitterTest::testSetGetTargetDetector ( )

Definition at line 74 of file ilDataEmitterTest.php.

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

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