19                include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
 
   23                require_once 
'./Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
 
   27                require_once 
'./Services/WorkflowEngine/classes/nodes/class.ilBasicNode.php';
 
   31                $this->workflow->addNode($this->node);
 
   33                require_once 
'./Services/WorkflowEngine/classes/detectors/class.ilCounterDetector.php';
 
   42                        $ilSetting->delete( 
'IL_PHPUNIT_TEST_MICROTIME' );
 
   55                        'Construction failed with valid context passed to constructor.' 
   66                $detector->setExpectedTriggerEvents($expected);
 
   67                $actual = $detector->getExpectedTriggerEvents();
 
   70                $this->assertEquals($actual, $expected);
 
   80                $detector->setActualTriggerEvents($expected);
 
   81                $actual = $detector->getActualTriggerEvents();
 
   84                $this->assertEquals($actual, $expected);
 
   92                $detector->setExpectedTriggerEvents($expected);
 
   95                $detector->trigger(
null);
 
   99                if ($detector->getActualTriggerEvents() != 1)
 
  101                        $valid_state = 
false;
 
  104                if($detector->getExpectedTriggerEvents() != $expected)
 
  106                        $valid_state = 
false;
 
  109                if ($detector->getDetectorState())
 
  111                        $valid_state = 
false;
 
  114                $this->assertTrue($valid_state, 
'Detector state invalid.');
 
  122                $detector->setExpectedTriggerEvents($expected);
 
  125                $detector->trigger(
null);
 
  126                $detector->trigger(
null);
 
  131                if ($detector->getActualTriggerEvents() != 2)
 
  133                        $valid_state = 
false;
 
  136                if($detector->getExpectedTriggerEvents() != $expected)
 
  138                        $valid_state = 
false;
 
  141                if (!$detector->getDetectorState())
 
  143                        $valid_state = 
false;
 
  146                $this->assertTrue($valid_state, 
'Detector state invalid.');
 
  154                $detector->setExpectedTriggerEvents($expected);
 
  157                $this->assertTrue($detector->trigger(
null));
 
  158                $this->assertTrue($detector->trigger(
null));
 
  159                $this->assertFalse($detector->trigger(
null));
 
  168                $actual = $detector->getContext();
 
  171                if ($actual === $this->node)
 
  173                        $this->assertEquals($actual, $this->node);
 
  175                        $this->assertTrue(
false, 
'Context not identical.');
 
An exception for terminatinating execution or to throw for unit testing.
@noinspection PhpIncludeInspection
ilCounterDetectorTest is part of the petri net based workflow engine.
testConstructorValidContext()
testSetGetExpectedTriggerEvents()
testSetGetActualTriggerEvents()
@noinspection PhpIncludeInspection
@noinspection PhpIncludeInspection