Skip to content

Commit 3ec914b

Browse files
authored
Merge pull request #11 from serroba/phpunit-update
Updating to newer version of PHP
2 parents ab65364 + 07c8a2d commit 3ec914b

4 files changed

Lines changed: 13 additions & 12 deletions

File tree

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
language: php
22

33
php:
4-
- 7.0
5-
- 7.1
4+
- "7.1"
65

76
install:
87
- composer install --no-interaction
@@ -12,7 +11,7 @@ before_script:
1211

1312
script:
1413
- ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml
15-
- ./phpcs.sh --dry-run --diff
14+
# - ./phpcs.sh --dry-run --diff
1615

1716
after_success:
1817
- ./vendor/bin/coveralls

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
}
1818
},
1919
"require": {
20-
"php": "~5.3 || ^7.0"
20+
"php": "^7.1"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "^6.0",
23+
"phpunit/phpunit": "^7.0",
2424
"satooshi/php-coveralls": "^1.0"
2525
}
2626
}

src/PHPUnit/Listeners/NaughtyTestListener.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33

44
use Exception;
55
use PetrKotek\NaughtyTestDetector\MetricFetcher;
6-
use PHPUnit\Framework\BaseTestListener;
76
use PHPUnit\Framework\Test;
87
use PHPUnit\Framework\TestCase;
8+
use PHPUnit\Framework\TestListener;
9+
use PHPUnit\Framework\TestListenerDefaultImplementation;
910
use PHPUnit\Framework\TestSuite;
1011

1112
/**
1213
* NaughtyTestListener is PHPUnit TestListener, which identifies tests, which don't clean up after themselves.
1314
*/
14-
class NaughtyTestListener extends BaseTestListener
15+
class NaughtyTestListener implements TestListener
1516
{
17+
use TestListenerDefaultImplementation;
1618
/** @var string Config key enabling execution of MetricFetcher on test-level (bool) */
1719
const CONFIG_KEY_LEVEL_TEST = 'executeOnTestLevel';
1820

@@ -78,7 +80,7 @@ public function __construct(
7880
/**
7981
* @param TestSuite $suite
8082
*/
81-
public function startTestSuite(TestSuite $suite)
83+
public function startTestSuite(TestSuite $suite): void
8284
{
8385
if ($this->testSuiteCounter === 0 &&
8486
($this->isLevelEnabled(self::CONFIG_KEY_LEVEL_SUITE) || $this->isLevelEnabled(
@@ -97,7 +99,7 @@ public function startTestSuite(TestSuite $suite)
9799
/**
98100
* @param TestSuite $suite
99101
*/
100-
public function endTestSuite(TestSuite $suite)
102+
public function endTestSuite(TestSuite $suite): void
101103
{
102104
$this->testSuiteCounter--;
103105
$currentMetrics = $this->isLevelEnabled(self::CONFIG_KEY_LEVEL_TEST) ? $this->metricsBeforeTest : null;
@@ -133,7 +135,7 @@ public function endTestSuite(TestSuite $suite)
133135
/**
134136
* @param Test $test
135137
*/
136-
public function startTest(Test $test)
138+
public function startTest(Test $test): void
137139
{
138140
if ($this->metricsBeforeTest === null && $this->isLevelEnabled(self::CONFIG_KEY_LEVEL_TEST)) {
139141
$this->metricsBeforeTest = $this->fetchMetrics();
@@ -144,7 +146,7 @@ public function startTest(Test $test)
144146
* @param Test $test
145147
* @param float $time
146148
*/
147-
public function endTest(Test $test, $time)
149+
public function endTest(Test $test, float $time): void
148150
{
149151
if (!($test instanceof TestCase)) {
150152
return;

tests/PHPUnit/Listeners/NaughtyTestListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
namespace PetrKotek\NaughtyTestDetector\Tests\PHPUnit\Listeners;
33

44
use PetrKotek\NaughtyTestDetector\PHPUnit\Listeners\NaughtyTestListener;
5+
use PHPUnit\Framework\MockObject\MockObject;
56
use PHPUnit\Framework\TestCase;
67
use PHPUnit\Framework\TestListener;
78
use PHPUnit\Framework\TestSuite;
8-
use PHPUnit_Framework_MockObject_MockObject as MockObject;
99

1010
class NaughtyTestListenerTest extends TestCase
1111
{

0 commit comments

Comments
 (0)