Skip to content

Commit 8c69cbb

Browse files
authored
Add 7.4 support (#62)
* Add 7.4 support Wider range of unit tests and fixing depricated stuff * Fix phpunit compatibility * Missed the shim from the commit * Clean up
1 parent 4614727 commit 8c69cbb

26 files changed

+124
-69
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ matrix:
1111
- php: 7.2
1212
env: UPDATE_COVERAGE=1
1313
- php: 7.3
14+
- php: 7.4
1415
fast_finish: true
1516
before_script:
1617
- composer global require squizlabs/php_codesniffer

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "exussum12/coverage-checker",
33
"description": "Allows checking the code coverage of a single pull request",
44
"require-dev": {
5-
"phpunit/phpunit": "^6.5"
5+
"phpunit/phpunit": "^6.5 || ^7.0 || ^8.0"
66
},
77
"license": "MIT",
88
"authors": [

phpunit.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
beStrictAboutTestsThatDoNotTestAnything="true"
99
beStrictAboutTodoAnnotatedTests="true"
1010
verbose="true">
11-
<testsuite>
11+
<testsuite name="coverageChecker">
1212
<directory suffix="Test.php">tests</directory>
1313
</testsuite>
1414

@@ -21,8 +21,8 @@
2121
<log
2222
type="coverage-html"
2323
target="report"
24-
lowUpperBound="35"
25-
highLowerBound="70"/>
24+
lowUpperBound="90"
25+
highLowerBound="95"/>
2626
<log type="coverage-clover" target="report/coverage.xml"/>
2727
</logging>
2828
</phpunit>

tests/ArgParserTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ class ArgParserTest extends TestCase
99
{
1010
protected $parser;
1111

12-
public function setUp()
12+
/**
13+
* @before
14+
*/
15+
public function setUpTest()
1316
{
1417
$args = [
1518
'file.php',
@@ -20,6 +23,7 @@ public function setUp()
2023
];
2124
$this->parser = new ArgParser($args);
2225
}
26+
2327
public function testNumericArgs()
2428
{
2529
$this->assertSame("file", $this->parser->getArg(1));

tests/GenericDiffFilterTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111
class GenericDiffFilterTest extends TestCase
1212
{
13+
use TestShim;
1314

1415
public function testValid()
1516
{
@@ -20,9 +21,9 @@ public function testValid()
2021
__DIR__ . '/fixtures/phpcs.json'
2122
];
2223
ob_start();
23-
require(__DIR__ . "/../src/Runners/generic.php");
24+
require(__DIR__ . '/../src/Runners/generic.php');
2425
$output = ob_get_clean();
25-
$this->assertContains('100.00%', $output);
26+
$this->assertContainsString('100.00%', $output);
2627
}
2728

2829
public function testMissingHandler()
@@ -34,10 +35,10 @@ public function testMissingHandler()
3435
];
3536
try {
3637
ob_start();
37-
require(__DIR__ . "/../src/Runners/generic.php");
38+
require(__DIR__ . '/../src/Runners/generic.php');
3839
} catch (Exception $exception) {
3940
$output = ob_get_clean();
40-
$this->assertContains('--phpcs', $output);
41+
$this->assertContainsString('--phpcs', $output);
4142
return true;
4243
}
4344

tests/Loaders/CheckstyleTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ class CheckstyleTest extends PhanTextTest
88
/** @var Checkstyle */
99
protected $phan;
1010
protected $prefix = '';
11-
protected function setUp()
11+
12+
/**
13+
* @before
14+
*/
15+
protected function setUpTest()
1216
{
13-
parent::setUp();
1417
$this->phan = new Checkstyle(__DIR__ . '/../fixtures/checkstyle.xml');
1518
}
1619
}

tests/Loaders/CodeClimateTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ class CodeClimateTest extends PhanTextTest
88
/** @var CodeClimate */
99
protected $phan;
1010
protected $prefix = '';
11-
protected function setUp()
11+
12+
/**
13+
* @before
14+
*/
15+
protected function setUpTest()
1216
{
13-
parent::setUp();
1417
$this->phan = new CodeClimate(__DIR__ . '/../fixtures/codeclimate.json');
1518
}
1619
}

tests/Loaders/HumbugLoaderTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
use InvalidArgumentException;
55
use PHPUnit\Framework\TestCase;
66
use exussum12\CoverageChecker\Loaders\Humbug;
7+
use exussum12\CoverageChecker\tests\TestShim;
78

89
class HumbugLoaderTest extends TestCase
910
{
11+
use TestShim;
12+
1013
public function testCanMakeClass()
1114
{
1215
$humbug = new Humbug(__DIR__ . '/../fixtures/humbug.json');
@@ -15,7 +18,7 @@ public function testCanMakeClass()
1518
$this->assertEquals(1, count($invalidFiles));
1619
$file = 'src/DiffLineHandle/OldVersion/DiffStart.php';
1720

18-
$this->assertContains(
21+
$this->assertContainsString(
1922
'Failed on escaped check',
2023
current($humbug->getErrorsOnLine($file, 23))
2124
);

tests/Loaders/LoadPhpcsReportTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ public function testCanMakeClass()
2323
);
2424
}
2525

26-
/**
27-
* @expectedException InvalidArgumentException
28-
*/
2926
public function testRejectsInvalidData()
3027
{
3128
$this->expectException(InvalidArgumentException::class);

tests/Loaders/PhanJsonTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ class PhanJsonTest extends PhanTextTest
77
{
88
/** @var PhanJsonTest */
99
protected $phan;
10-
protected function setUp()
10+
11+
/**
12+
* @before
13+
*/
14+
protected function setUpTest()
1115
{
12-
parent::setUp();
1316
$this->phan = new PhanJson(__DIR__ . '/../fixtures/phan.json');
1417
}
1518
}

0 commit comments

Comments
 (0)