Skip to content

Commit 0c4b9b7

Browse files
committed
Updating phpunit to a version that's still used
1 parent 58f80a9 commit 0c4b9b7

12 files changed

+54
-31
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ php:
88
env: # important!
99
matrix:
1010
allow_failures:
11+
- php: 5.6
1112
- php: nightly
1213

1314
before_script:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"lukasoppermann/http-status": "2.*"
2525
},
2626
"require-dev": {
27-
"phpunit/phpunit": "5.7.*",
27+
"phpunit/phpunit": "7.*",
2828
"theseer/autoload": "1.*"
2929
},
3030
"autoload": {

src/PHPDraft/In/ApibFileParser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
namespace PHPDraft\In;
1111

12+
use PHPDraft\Parse\ExecutionException;
13+
1214
/**
1315
* Class ApibFileParser.
1416
*/
@@ -92,7 +94,7 @@ private function get_apib($filename)
9294
private function file_check($filename)
9395
{
9496
if (!file_exists($filename)) {
95-
throw new \RuntimeException("API File not found: $filename", 1);
97+
throw new ExecutionException("API File not found: $filename", 1);
9698
}
9799
}
98100

src/PHPDraft/In/Tests/ApibFileParserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testFilenameSetup()
5353

5454
/**
5555
* Test if exception when the file doesn't exist
56-
* @expectedException \RuntimeException
56+
* @expectedException \PHPDraft\Parse\ExecutionException
5757
* @expectedExceptionCode 1
5858
* @expectedExceptionMessageRegExp "API File not found: [\w\W]*\/drafter\/non_existing_including_apib"
5959
*

src/PHPDraft/Out/TemplateGenerator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Michelf\MarkdownExtra;
1414
use PHPDraft\Model\Category;
1515
use PHPDraft\Model\Elements\ObjectStructureElement;
16+
use PHPDraft\Parse\ExecutionException;
1617

1718
class TemplateGenerator
1819
{
@@ -98,7 +99,7 @@ public function get($object)
9899
{
99100
$include = $this->find_include_file($this->template);
100101
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);
102103
}
103104

104105
//Prepare base data

src/PHPDraft/Out/UI.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
namespace PHPDraft\Out;
1111

12+
use PHPDraft\Parse\ExecutionException;
13+
1214
/**
1315
* Class UI.
1416
*/
@@ -50,7 +52,7 @@ public static function main($argv = [])
5052
file_put_contents('php://stderr', 'Not enough arguments' . PHP_EOL);
5153
(new self())->help();
5254

53-
throw new \RuntimeException('', 1);
55+
throw new ExecutionException('', 1);
5456
}
5557

5658
$sorting = -1;
@@ -65,19 +67,19 @@ public static function main($argv = [])
6567
if (isset($options['h'])) {
6668
(new self())->help();
6769

68-
throw new \RuntimeException('', 0);
70+
throw new ExecutionException('', 0);
6971
}
7072

7173
if (isset($options['v'])) {
7274
(new self())->version();
7375

74-
throw new \RuntimeException('', 0);
76+
throw new ExecutionException('', 0);
7577
}
7678

7779
if (isset($options['f'])) {
7880
$file = $options['f'];
7981
} else {
80-
throw new \RuntimeException('No file to parse', 1);
82+
throw new ExecutionException('No file to parse', 1);
8183
}
8284
} else {
8385
$file = $argv[1];

src/PHPDraft/Parse/BaseParser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function parseToJson()
7676
if (json_last_error() !== JSON_ERROR_NONE) {
7777
file_put_contents('php://stderr', 'ERROR: invalid json in ' . $this->tmp_dir . '/index.json');
7878

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);
8080
}
8181

8282
$warnings = FALSE;
@@ -91,7 +91,7 @@ public function parseToJson()
9191
}
9292

9393
if ($warnings) {
94-
throw new \RuntimeException('Parsing encountered errors and stopped', 2);
94+
throw new ExecutionException('Parsing encountered errors and stopped', 2);
9595
}
9696

9797
return $this->json;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
}

src/PHPDraft/Parse/Tests/BaseParserTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
namespace PHPDraft\Parse\Tests;
1010

1111
use PHPDraft\Core\BaseTest;
12-
use PHPDraft\Parse\Drafter;
1312
use ReflectionClass;
1413

1514
/**
@@ -115,7 +114,7 @@ public function testParseToJSONMkTmp()
115114
* Check if parsing the fails when invalid JSON
116115
*
117116
* @covers \PHPDraft\Parse\Drafter::parseToJson()
118-
* @expectedException \RuntimeException
117+
* @expectedException \PHPDraft\Parse\ExecutionException
119118
* @expectedExceptionMessage Drafter generated invalid JSON (ERROR)
120119
* @expectedExceptionCode 2
121120
*/

src/PHPDraft/Parse/Tests/DrafterAPITest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
namespace PHPDraft\Parse\Tests;
1010

1111
use PHPDraft\Core\BaseTest;
12-
use PHPDraft\Parse\Drafter;
1312
use PHPDraft\Parse\DrafterAPI;
13+
1414
use ReflectionClass;
15-
use SebastianBergmann\GlobalState\RuntimeException;
1615

1716
/**
1817
* Class DrafterAPITest
@@ -66,7 +65,7 @@ public function testSetupCorrectly()
6665
/**
6766
* Test if the value the class is initialized with is correct
6867
*
69-
* @expectedException RuntimeException
68+
* @expectedException \PHPDraft\Parse\ResourceException
7069
* @expectedExceptionMessage Drafter webservice is not available!
7170
* @expectedExceptionCode 1
7271
*/
@@ -92,7 +91,7 @@ public function testPreRunStringIsEmpty()
9291
* Check if parsing the fails without drafter
9392
*
9493
* @covers \PHPDraft\Parse\DrafterAPI::parseToJson()
95-
* @expectedException \RuntimeException
94+
* @expectedException \PHPDraft\Parse\ResourceException
9695
* @expectedExceptionMessage Drafter webservice failed to parse input
9796
* @expectedExceptionCode 1
9897
*/

0 commit comments

Comments
 (0)