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

Commit 5725335

Browse files
committed
phpunit7 compat
1 parent 980c4a6 commit 5725335

19 files changed

+142
-103
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
}

0 commit comments

Comments
 (0)