File tree Expand file tree Collapse file tree 12 files changed +54
-31
lines changed Expand file tree Collapse file tree 12 files changed +54
-31
lines changed Original file line number Diff line number Diff line change 8
8
env : # important!
9
9
matrix :
10
10
allow_failures :
11
+ - php : 5.6
11
12
- php : nightly
12
13
13
14
before_script :
Original file line number Diff line number Diff line change 24
24
"lukasoppermann/http-status" : " 2.*"
25
25
},
26
26
"require-dev" : {
27
- "phpunit/phpunit" : " 5. 7.*" ,
27
+ "phpunit/phpunit" : " 7.*" ,
28
28
"theseer/autoload" : " 1.*"
29
29
},
30
30
"autoload" : {
Original file line number Diff line number Diff line change 9
9
10
10
namespace PHPDraft \In ;
11
11
12
+ use PHPDraft \Parse \ExecutionException ;
13
+
12
14
/**
13
15
* Class ApibFileParser.
14
16
*/
@@ -92,7 +94,7 @@ private function get_apib($filename)
92
94
private function file_check ($ filename )
93
95
{
94
96
if (!file_exists ($ filename )) {
95
- throw new \ RuntimeException ("API File not found: $ filename " , 1 );
97
+ throw new ExecutionException ("API File not found: $ filename " , 1 );
96
98
}
97
99
}
98
100
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ public function testFilenameSetup()
53
53
54
54
/**
55
55
* Test if exception when the file doesn't exist
56
- * @expectedException \RuntimeException
56
+ * @expectedException \PHPDraft\Parse\ExecutionException
57
57
* @expectedExceptionCode 1
58
58
* @expectedExceptionMessageRegExp "API File not found: [\w\W]*\/drafter\/non_existing_including_apib"
59
59
*
Original file line number Diff line number Diff line change 13
13
use Michelf \MarkdownExtra ;
14
14
use PHPDraft \Model \Category ;
15
15
use PHPDraft \Model \Elements \ObjectStructureElement ;
16
+ use PHPDraft \Parse \ExecutionException ;
16
17
17
18
class TemplateGenerator
18
19
{
@@ -98,7 +99,7 @@ public function get($object)
98
99
{
99
100
$ include = $ this ->find_include_file ($ this ->template );
100
101
if ($ include === NULL ) {
101
- throw new \ RuntimeException ("Couldn't find template ' $ this ->template ' " , 1 );
102
+ throw new ExecutionException ("Couldn't find template ' $ this ->template ' " , 1 );
102
103
}
103
104
104
105
//Prepare base data
Original file line number Diff line number Diff line change 9
9
10
10
namespace PHPDraft \Out ;
11
11
12
+ use PHPDraft \Parse \ExecutionException ;
13
+
12
14
/**
13
15
* Class UI.
14
16
*/
@@ -50,7 +52,7 @@ public static function main($argv = [])
50
52
file_put_contents ('php://stderr ' , 'Not enough arguments ' . PHP_EOL );
51
53
(new self ())->help ();
52
54
53
- throw new \ RuntimeException ('' , 1 );
55
+ throw new ExecutionException ('' , 1 );
54
56
}
55
57
56
58
$ sorting = -1 ;
@@ -65,19 +67,19 @@ public static function main($argv = [])
65
67
if (isset ($ options ['h ' ])) {
66
68
(new self ())->help ();
67
69
68
- throw new \ RuntimeException ('' , 0 );
70
+ throw new ExecutionException ('' , 0 );
69
71
}
70
72
71
73
if (isset ($ options ['v ' ])) {
72
74
(new self ())->version ();
73
75
74
- throw new \ RuntimeException ('' , 0 );
76
+ throw new ExecutionException ('' , 0 );
75
77
}
76
78
77
79
if (isset ($ options ['f ' ])) {
78
80
$ file = $ options ['f ' ];
79
81
} else {
80
- throw new \ RuntimeException ('No file to parse ' , 1 );
82
+ throw new ExecutionException ('No file to parse ' , 1 );
81
83
}
82
84
} else {
83
85
$ file = $ argv [1 ];
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ public function parseToJson()
76
76
if (json_last_error () !== JSON_ERROR_NONE ) {
77
77
file_put_contents ('php://stderr ' , 'ERROR: invalid json in ' . $ this ->tmp_dir . '/index.json ' );
78
78
79
- throw new \ RuntimeException ('Drafter generated invalid JSON ( ' . json_last_error_msg () . ') ' , 2 );
79
+ throw new ExecutionException ('Drafter generated invalid JSON ( ' . json_last_error_msg () . ') ' , 2 );
80
80
}
81
81
82
82
$ warnings = FALSE ;
@@ -91,7 +91,7 @@ public function parseToJson()
91
91
}
92
92
93
93
if ($ warnings ) {
94
- throw new \ RuntimeException ('Parsing encountered errors and stopped ' , 2 );
94
+ throw new ExecutionException ('Parsing encountered errors and stopped ' , 2 );
95
95
}
96
96
97
97
return $ this ->json ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * This file contains the ExecutionException.php.
4
+ *
5
+ * @package PHPDraft\Parse
6
+ *
7
+ * @author Sean Molenaar<[email protected] >
8
+ */
9
+
10
+ namespace PHPDraft \Parse ;
11
+
12
+ /**
13
+ * Class ExecutionException.
14
+ *
15
+ * @package Parse
16
+ */
17
+ class ExecutionException extends \Exception
18
+ {
19
+ }
Original file line number Diff line number Diff line change 9
9
namespace PHPDraft \Parse \Tests ;
10
10
11
11
use PHPDraft \Core \BaseTest ;
12
- use PHPDraft \Parse \Drafter ;
13
12
use ReflectionClass ;
14
13
15
14
/**
@@ -115,7 +114,7 @@ public function testParseToJSONMkTmp()
115
114
* Check if parsing the fails when invalid JSON
116
115
*
117
116
* @covers \PHPDraft\Parse\Drafter::parseToJson()
118
- * @expectedException \RuntimeException
117
+ * @expectedException \PHPDraft\Parse\ExecutionException
119
118
* @expectedExceptionMessage Drafter generated invalid JSON (ERROR)
120
119
* @expectedExceptionCode 2
121
120
*/
Original file line number Diff line number Diff line change 9
9
namespace PHPDraft \Parse \Tests ;
10
10
11
11
use PHPDraft \Core \BaseTest ;
12
- use PHPDraft \Parse \Drafter ;
13
12
use PHPDraft \Parse \DrafterAPI ;
13
+
14
14
use ReflectionClass ;
15
- use SebastianBergmann \GlobalState \RuntimeException ;
16
15
17
16
/**
18
17
* Class DrafterAPITest
@@ -66,7 +65,7 @@ public function testSetupCorrectly()
66
65
/**
67
66
* Test if the value the class is initialized with is correct
68
67
*
69
- * @expectedException RuntimeException
68
+ * @expectedException \PHPDraft\Parse\ResourceException
70
69
* @expectedExceptionMessage Drafter webservice is not available!
71
70
* @expectedExceptionCode 1
72
71
*/
@@ -92,7 +91,7 @@ public function testPreRunStringIsEmpty()
92
91
* Check if parsing the fails without drafter
93
92
*
94
93
* @covers \PHPDraft\Parse\DrafterAPI::parseToJson()
95
- * @expectedException \RuntimeException
94
+ * @expectedException \PHPDraft\Parse\ResourceException
96
95
* @expectedExceptionMessage Drafter webservice failed to parse input
97
96
* @expectedExceptionCode 1
98
97
*/
You can’t perform that action at this time.
0 commit comments