ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.test_case_01.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4use PHPUnit\Framework\TestCase;
5
12class test_case_01 extends TestCase
13{
14 #region Helper
15 public $base_path = './Services/WorkflowEngine/test/parser/';
16 public $suite_path = 'case_01/';
17
18 public function getTestInputFilename($test_name)
19 {
20 return $this->base_path . $this->suite_path . $test_name . '.bpmn2';
21 }
22
23 public function getTestOutputFilename($test_name)
24 {
25 return $this->base_path . $this->suite_path . $test_name . '_output.php';
26 }
27
28 public function getTestGoldsampleFilename($test_name)
29 {
30 return $this->base_path . $this->suite_path . $test_name . '_goldsample.php';
31 }
32
33 public function setUp() : void
34 {
35 chdir(dirname(__FILE__));
36 chdir('../../../../../');
37
38 require_once './Services/WorkflowEngine/classes/parser/class.ilBPMN2Parser.php';
39 }
40
42 {
43 $test_name = 'Booking_System_FullDiagram';
44 $xml = file_get_contents($this->getTestInputFilename($test_name));
45 $parser = new ilBPMN2Parser();
46 $parse_result = $parser->parseBPMN2XML($xml);
47
48 file_put_contents($this->getTestOutputFilename($test_name), $parse_result);
49 $return = exec('php -l ' . $this->getTestOutputFilename($test_name));
50
51 $this->assertTrue(substr($return, 0, 25) == 'No syntax errors detected', 'Lint of output code failed.');
52
53 $goldsample = file_get_contents($this->getTestGoldsampleFilename($test_name));
54 //$this->assertEquals($goldsample, $parse_result, 'Output does not match goldsample.');
55 // Disarmed due to whitespace-issues.
56
57 require_once $this->getTestOutputFilename($test_name);
58 $process = new $test_name;
59 $this->assertFalse($process->isActive());
60
61 unlink($this->getTestOutputFilename($test_name));
62 }
63}
$parser
Definition: BPMN2Parser.php:23
$parse_result
Definition: BPMN2Parser.php:25
An exception for terminatinating execution or to throw for unit testing.
getTestGoldsampleFilename($test_name)
test_WorkflowWithSimpleEndEventShouldOutputAccordingly()
getTestInputFilename($test_name)
getTestOutputFilename($test_name)
$xml
Definition: metadata.php:332