Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit 164e896

Browse files
authored
Merge branch '7.0' into 6.0
2 parents 5d1433e + 5725335 commit 164e896

19 files changed

+132
-100
lines changed

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
}
1111
],
1212
"require": {
13-
"phpunit/phpunit": ">=4.8.28 <5.0.0 || >=5.6.3 <7.0",
14-
"phpunit/php-code-coverage": ">=2.2.4 <6.0",
15-
"sebastian/comparator": ">1.1 <3.0",
16-
"sebastian/diff": ">=1.4 <4.0"
13+
"phpunit/phpunit": "^7.0",
14+
"phpunit/php-code-coverage": "^6.0",
15+
"sebastian/comparator": "^2.0",
16+
"sebastian/diff": "^3.0"
1717
},
1818
"autoload":{
1919
"psr-4":{

src/Constraint/Crawler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class Crawler extends Page
1010
{
11-
protected function matches($nodes)
11+
protected function matches($nodes) : bool
1212
{
1313
/** @var $nodes DomCrawler * */
1414
if (!$nodes->count()) {
@@ -26,7 +26,7 @@ protected function matches($nodes)
2626
return false;
2727
}
2828

29-
protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure = null)
29+
protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure = null):void
3030
{
3131
/** @var $nodes DomCrawler * */
3232
if (!$nodes->count()) {
@@ -51,7 +51,7 @@ protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure
5151
);
5252
}
5353

54-
protected function failureDescription($other)
54+
protected function failureDescription($other) : string
5555
{
5656
$desc = '';
5757
foreach ($other as $o) {

src/Constraint/CrawlerNot.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
class CrawlerNot extends Crawler
77
{
8-
protected function matches($nodes)
8+
protected function matches($nodes) : bool
99
{
1010
return !parent::matches($nodes);
1111
}
1212

13-
protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure = null)
13+
protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure = null) : void
1414
{
1515
if (!$this->string) {
1616
throw new \PHPUnit\Framework\ExpectationFailedException(

src/Constraint/JsonContains.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(array $expected)
2828
*
2929
* @return bool
3030
*/
31-
protected function matches($other)
31+
protected function matches($other) : bool
3232
{
3333
$jsonResponseArray = new JsonArray($other);
3434
if (!is_array($jsonResponseArray->toArray())) {
@@ -62,7 +62,7 @@ public function toString()
6262
return '';
6363
}
6464

65-
protected function failureDescription($other)
65+
protected function failureDescription($other) : string
6666
{
6767
//unused
6868
return '';

src/Constraint/JsonType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __construct(array $jsonType, $match = true)
2525
*
2626
* @return bool
2727
*/
28-
protected function matches($jsonArray)
28+
protected function matches($jsonArray) : bool
2929
{
3030
if ($jsonArray instanceof JsonArray) {
3131
$jsonArray = $jsonArray->toArray();
@@ -56,7 +56,7 @@ public function toString()
5656
return '';
5757
}
5858

59-
protected function failureDescription($other)
59+
protected function failureDescription($other) : string
6060
{
6161
//unused
6262
return '';

src/Constraint/Page.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct($string, $uri = '')
2222
*
2323
* @return bool
2424
*/
25-
protected function matches($other)
25+
protected function matches($other) : bool
2626
{
2727
$other = $this->normalizeText($other);
2828
return mb_stripos($other, $this->string, null, 'UTF-8') !== false;
@@ -53,7 +53,7 @@ public function toString()
5353
);
5454
}
5555

56-
protected function failureDescription($pageContent)
56+
protected function failureDescription($pageContent) : string
5757
{
5858
$message = $this->uriMessage('on page');
5959
$message->append("\n--> ");

src/Constraint/WebDriver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class WebDriver extends Page
1010
{
1111

12-
protected function matches($nodes)
12+
protected function matches($nodes) : bool
1313
{
1414
if (!count($nodes)) {
1515
return false;
@@ -30,7 +30,7 @@ protected function matches($nodes)
3030
return false;
3131
}
3232

33-
protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure = null)
33+
protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure = null) : void
3434
{
3535
if (!count($nodes)) {
3636
throw new ElementNotFound($selector, 'Element located either by name, CSS or XPath');
@@ -54,7 +54,7 @@ protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure
5454
);
5555
}
5656

57-
protected function failureDescription($nodes)
57+
protected function failureDescription($nodes) : string
5858
{
5959
$desc = '';
6060
foreach ($nodes as $node) {

src/Constraint/WebDriverNot.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
class WebDriverNot extends WebDriver
88
{
9-
protected function matches($nodes)
9+
protected function matches($nodes) : bool
1010
{
1111
return !parent::matches($nodes);
1212
}
1313

14-
protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure = null)
14+
protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure = null) : void
1515
{
1616
$selectorString = Locator::humanReadableString($selector);
1717
if (!$this->string) {

src/FilterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
class FilterTest extends \PHPUnit\Runner\Filter\NameFilterIterator
1313
{
14-
public function accept()
14+
public function accept():bool
1515
{
1616
$test = $this->getInnerIterator()->current();
1717

src/Init.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ class Init
1010
public static function init()
1111
{
1212
require_once __DIR__ . DIRECTORY_SEPARATOR . 'shim.php';
13+
require_once __DIR__ . DIRECTORY_SEPARATOR . 'phpunit7-interfaces.php';
1314
}
1415
}

src/Listener.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,32 @@ public function __construct(EventDispatcher $dispatcher)
3030
* Risky test.
3131
*
3232
* @param PHPUnit\Framework\Test $test
33-
* @param Exception $e
33+
* @param \Throwable $e
3434
* @param float $time
3535
* @since Method available since Release 4.0.0
3636
*/
37-
public function addRiskyTest(\PHPUnit\Framework\Test $test, Exception $e, $time)
37+
public function addRiskyTest(\PHPUnit\Framework\Test $test, \Throwable $e, float $time) : void
3838
{
3939
}
4040

41-
public function addFailure(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\AssertionFailedError $e, $time)
41+
public function addFailure(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\AssertionFailedError $e, float $time) : void
4242
{
4343
$this->unsuccessfulTests[] = spl_object_hash($test);
4444
$this->fire(Events::TEST_FAIL, new FailEvent($test, $time, $e));
4545
}
4646

47-
public function addError(\PHPUnit\Framework\Test $test, \Exception $e, $time)
47+
public function addError(\PHPUnit\Framework\Test $test, \Throwable $e, float $time) : void
4848
{
4949
$this->unsuccessfulTests[] = spl_object_hash($test);
5050
$this->fire(Events::TEST_ERROR, new FailEvent($test, $time, $e));
5151
}
5252

5353
// This method was added in PHPUnit 6
54-
public function addWarning(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Warning $e, $time)
54+
public function addWarning(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Warning $e, float $time) : void
5555
{
5656
}
5757

58-
public function addIncompleteTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
58+
public function addIncompleteTest(\PHPUnit\Framework\Test $test, \Throwable $e, float $time) : void
5959
{
6060
if (in_array(spl_object_hash($test), $this->skippedTests)) {
6161
return;
@@ -65,7 +65,7 @@ public function addIncompleteTest(\PHPUnit\Framework\Test $test, \Exception $e,
6565
$this->skippedTests[] = spl_object_hash($test);
6666
}
6767

68-
public function addSkippedTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
68+
public function addSkippedTest(\PHPUnit\Framework\Test $test, \Throwable $e, float $time) : void
6969
{
7070
if (in_array(spl_object_hash($test), $this->skippedTests)) {
7171
return;
@@ -75,17 +75,17 @@ public function addSkippedTest(\PHPUnit\Framework\Test $test, \Exception $e, $ti
7575
$this->skippedTests[] = spl_object_hash($test);
7676
}
7777

78-
public function startTestSuite(\PHPUnit\Framework\TestSuite $suite)
78+
public function startTestSuite(\PHPUnit\Framework\TestSuite $suite) : void
7979
{
8080
$this->dispatcher->dispatch('suite.start', new SuiteEvent($suite));
8181
}
8282

83-
public function endTestSuite(\PHPUnit\Framework\TestSuite $suite)
83+
public function endTestSuite(\PHPUnit\Framework\TestSuite $suite) : void
8484
{
8585
$this->dispatcher->dispatch('suite.end', new SuiteEvent($suite));
8686
}
8787

88-
public function startTest(\PHPUnit\Framework\Test $test)
88+
public function startTest(\PHPUnit\Framework\Test $test) : void
8989
{
9090
$this->dispatcher->dispatch(Events::TEST_START, new TestEvent($test));
9191
if (!$test instanceof TestInterface) {
@@ -102,12 +102,12 @@ public function startTest(\PHPUnit\Framework\Test $test)
102102
$test->getTestResultObject()->addFailure($test, $e, 0);
103103
} catch (\PHPUnit\Framework\SkippedTestError $e) {
104104
$test->getTestResultObject()->addFailure($test, $e, 0);
105-
} catch (\Exception $e) {
105+
} catch (\Throwable $e) {
106106
$test->getTestResultObject()->addError($test, $e, 0);
107107
}
108108
}
109109

110-
public function endTest(\PHPUnit\Framework\Test $test, $time)
110+
public function endTest(\PHPUnit\Framework\Test $test, float $time) : void
111111
{
112112
$hash = spl_object_hash($test);
113113
if (!in_array($hash, $this->unsuccessfulTests)) {

src/Log/JUnit.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ class JUnit extends \PHPUnit\Util\Log\JUnit
99
{
1010
protected $strictAttributes = ['file', 'name', 'class'];
1111

12-
public function startTest(\PHPUnit\Framework\Test $test)
12+
public function startTest(\PHPUnit\Framework\Test $test):void
1313
{
1414
if (!$test instanceof Reported) {
15-
return parent::startTest($test);
15+
parent::startTest($test);
16+
return;
1617
}
1718

1819
$this->currentTestCase = $this->document->createElement('testcase');
@@ -27,7 +28,7 @@ public function startTest(\PHPUnit\Framework\Test $test)
2728
}
2829
}
2930

30-
public function endTest(\PHPUnit\Framework\Test $test, $time)
31+
public function endTest(\PHPUnit\Framework\Test $test, float $time):void
3132
{
3233
if ($this->currentTestCase !== null and $test instanceof Test) {
3334
$numAssertions = $test->getNumAssertions();

src/ResultPrinter.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ class ResultPrinter extends \PHPUnit\Util\TestDox\ResultPrinter
1111
* An error occurred.
1212
*
1313
* @param \PHPUnit\Framework\Test $test
14-
* @param \Exception $e
14+
* @param \Throwable $e
1515
* @param float $time
1616
*/
17-
public function addError(\PHPUnit\Framework\Test $test, \Exception $e, $time)
17+
public function addError(\PHPUnit\Framework\Test $test, \Throwable $e, float $time) : void
1818
{
1919
$this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_ERROR;
2020
$this->failed++;
@@ -27,7 +27,7 @@ public function addError(\PHPUnit\Framework\Test $test, \Exception $e, $time)
2727
* @param \PHPUnit\Framework\AssertionFailedError $e
2828
* @param float $time
2929
*/
30-
public function addFailure(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\AssertionFailedError $e, $time)
30+
public function addFailure(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\AssertionFailedError $e, float $time) : void
3131
{
3232
$this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_FAILURE;
3333
$this->failed++;
@@ -37,10 +37,10 @@ public function addFailure(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Ass
3737
* Incomplete test.
3838
*
3939
* @param \PHPUnit\Framework\Test $test
40-
* @param \Exception $e
40+
* @param \Throwable $e
4141
* @param float $time
4242
*/
43-
public function addIncompleteTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
43+
public function addIncompleteTest(\PHPUnit\Framework\Test $test, \Throwable $e, float $time) : void
4444
{
4545
$this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_INCOMPLETE;
4646
$this->incomplete++;
@@ -50,12 +50,12 @@ public function addIncompleteTest(\PHPUnit\Framework\Test $test, \Exception $e,
5050
* Risky test.
5151
*
5252
* @param \PHPUnit\Framework\Test $test
53-
* @param \Exception $e
53+
* @param \Throwable $e
5454
* @param float $time
5555
*
5656
* @since Method available since Release 4.0.0
5757
*/
58-
public function addRiskyTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
58+
public function addRiskyTest(\PHPUnit\Framework\Test $test, \Throwable $e, float $time) : void
5959
{
6060
$this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_RISKY;
6161
$this->risky++;
@@ -65,18 +65,18 @@ public function addRiskyTest(\PHPUnit\Framework\Test $test, \Exception $e, $time
6565
* Skipped test.
6666
*
6767
* @param \PHPUnit\Framework\Test $test
68-
* @param \Exception $e
68+
* @param \Throwable $e
6969
* @param float $time
7070
*
7171
* @since Method available since Release 3.0.0
7272
*/
73-
public function addSkippedTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
73+
public function addSkippedTest(\PHPUnit\Framework\Test $test, \Throwable $e, float $time) : void
7474
{
7575
$this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_SKIPPED;
7676
$this->skipped++;
7777
}
7878

79-
public function startTest(\PHPUnit\Framework\Test $test)
79+
public function startTest(\PHPUnit\Framework\Test $test) : void
8080
{
8181
$this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_PASSED;
8282
}

0 commit comments

Comments
 (0)