ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.test_002_StartEvent.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/WorkflowEngine/test/ilWorkflowEngineBaseTest.php';
5 
13 {
14  public function setUp()
15  {
16  chdir(dirname(__FILE__));
17  chdir('../../../../../');
18 
19  parent::setUp();
20 
21  require_once './Services/WorkflowEngine/classes/parser/class.ilBPMN2Parser.php';
22  }
23 
25  {
26  $xml = file_get_contents('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Blank.bpmn2');
27  $parser = new ilBPMN2Parser();
28  $parse_result = $parser->parseBPMN2XML($xml);
29 
30  file_put_contents('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Blank_output.php', $parse_result);
31  $return = exec('php -l ./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Blank_output.php');
32  $this->assertTrue(substr($return, 0, 25) == 'No syntax errors detected', 'Lint of output code failed.');
33 
34 
35  $goldsample = file_get_contents('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Blank_goldsample.php');
36  $this->assertEquals($goldsample, $parse_result, 'Output does not match goldsample.');
37 
38  require_once './Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Blank_output.php';
39  $process = new StartEvent_Blank();
40  $this->assertFalse($process->isActive());
41 
42  // Here I would start the workflow, but that leads to saving it to the database which is currently not supported.
43 
44  unlink('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Blank_output.php');
45  }
46 
48  {
49  $xml = file_get_contents('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Message.bpmn2');
50  $parser = new ilBPMN2Parser();
51  $parse_result = $parser->parseBPMN2XML($xml);
52 
53  file_put_contents('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Message_output.php', $parse_result);
54  $return = exec('php -l ./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Message_output.php');
55  $this->assertTrue(substr($return, 0, 25) == 'No syntax errors detected', 'Lint of output code failed.');
56 
57 
58  $goldsample = file_get_contents('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Message_goldsample.php');
59  $this->assertEquals($goldsample, $parse_result, 'Output does not match goldsample.');
60 
61  require_once './Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Message_output.php';
62  $process = new StartEvent_Message();
63  $this->assertFalse($process->isActive());
64 
65  unlink('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Message_output.php');
66  }
67 
69  {
70  $xml = file_get_contents('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Signal.bpmn2');
71  $parser = new ilBPMN2Parser();
72  $parse_result = $parser->parseBPMN2XML($xml);
73 
74  file_put_contents('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Signal_output.php', $parse_result);
75  $return = exec('php -l ./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Signal_output.php');
76  $this->assertTrue(substr($return, 0, 25) == 'No syntax errors detected', 'Lint of output code failed.');
77 
78  $goldsample = file_get_contents('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Signal_goldsample.php');
79  $this->assertEquals($goldsample, $parse_result, 'Output does not match goldsample.');
80 
81  require_once './Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Signal_output.php';
82  $process = new StartEvent_Signal();
83  $this->assertFalse($process->isActive());
84 
85  unlink('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Signal_output.php');
86  }
87 
89  {
90  $xml = file_get_contents('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Timer_Date.bpmn2');
91  $parser = new ilBPMN2Parser();
92  $parse_result = $parser->parseBPMN2XML($xml);
93 
94  file_put_contents('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Timer_Date_output.php', $parse_result);
95  $return = exec('php -l ./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Timer_Date_output.php');
96  $this->assertTrue(substr($return, 0, 25) == 'No syntax errors detected', 'Lint of output code failed.');
97 
98  $goldsample = file_get_contents('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Timer_Date_goldsample.php');
99  $this->assertEquals($goldsample, $parse_result, 'Output does not match goldsample.');
100 
101  require_once './Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Timer_Date_output.php';
102  $process = new StartEvent_Timer_Date();
103  $this->assertFalse($process->isActive());
104 
105  unlink('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_Timer_Date_output.php');
106  }
107 
109  {
110  $xml = file_get_contents('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_MultiStart.bpmn2');
111  $parser = new ilBPMN2Parser();
112  $parse_result = $parser->parseBPMN2XML($xml);
113 
114  file_put_contents('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_MultiStart_output.php', $parse_result);
115  $return = exec('php -l ./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_MultiStart_output.php');
116  $this->assertTrue(substr($return, 0, 25) == 'No syntax errors detected', 'Lint of output code failed.');
117 
118  $goldsample = file_get_contents('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_MultiStart_goldsample.php');
119  $this->assertEquals($goldsample, $parse_result, 'Output does not match goldsample.');
120 
121  require_once './Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_MultiStart_output.php';
122  $process = new StartEvent_Multistart();
123  $this->assertFalse($process->isActive());
124 
125  unlink('./Services/WorkflowEngine/test/parser/002_StartEvent/StartEvent_MultiStart_output.php');
126  }
127 }
Class ilWorkflowEngineBaseTest.
$parse_result
Definition: BPMN2Parser.php:25
$xml
Definition: metadata.php:240
$parser
Definition: BPMN2Parser.php:23
Class ilBPMN2Parser.