Skip to content

Commit

Permalink
Merge pull request #184 from SimonFrings/tests1x
Browse files Browse the repository at this point in the history
Update PHPUnit configuration schema for PHPUnit 9.3 and run tests on PHPUnit 9 (promise-1.x)
  • Loading branch information
WyriHaximus committed Jan 27, 2021
2 parents 20246a3 + c28e65a commit 1b38b07
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
/.travis.yml export-ignore
/examples/ export-ignore
/phpunit.xml.dist export-ignore
/phpunit.xml.legacy export-ignore
/tests/ export-ignore
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ install:
- composer install

script:
- vendor/bin/phpunit --coverage-text
- if [[ "$TRAVIS_PHP_VERSION" > "7.2" ]]; then vendor/bin/phpunit --coverage-text; fi
- if [[ "$TRAVIS_PHP_VERSION" < "7.3" ]]; then vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy; fi
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "^9.0 || ^5.7 || ^4.8.35"
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35"
},
"autoload": {
"psr-4": {
Expand Down
16 changes: 10 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="vendor/autoload.php" colors="true">
<!-- PHPUnit configuration file with new format for PHPUnit 9.3+ -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
cacheResult="false">
<testsuites>
<testsuite name="Promise Test Suite">
<directory>./tests/React/Promise/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<coverage>
<include>
<directory>./src/</directory>
</whitelist>
</filter>
</include>
</coverage>
</phpunit>
18 changes: 18 additions & 0 deletions phpunit.xml.legacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- PHPUnit configuration file with old format for PHPUnit 9.2 or older -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
<testsuites>
<testsuite name="Promise Test Suite">
<directory>./tests/React/Promise/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>
</phpunit>
24 changes: 8 additions & 16 deletions tests/React/Promise/DeferredProgressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,10 @@ public function shouldAllowResolveAfterProgress()
$d = new Deferred();

$mock = $this->createCallableMock();
$mock
->expects($this->at(0))
->method('__invoke')
->with($this->identicalTo(1));
$mock
->expects($this->at(1))
->method('__invoke')
->with($this->identicalTo(2));
$mock->expects($this->exactly(2))->method('__invoke')->withConsecutive(
array($this->identicalTo(1)),
array($this->identicalTo(2))
);

$d
->promise()
Expand All @@ -290,14 +286,10 @@ public function shouldAllowRejectAfterProgress()
$d = new Deferred();

$mock = $this->createCallableMock();
$mock
->expects($this->at(0))
->method('__invoke')
->with($this->identicalTo(1));
$mock
->expects($this->at(1))
->method('__invoke')
->with($this->identicalTo(2));
$mock->expects($this->exactly(2))->method('__invoke')->withConsecutive(
array($this->identicalTo(1)),
array($this->identicalTo(2))
);

$d
->promise()
Expand Down

0 comments on commit 1b38b07

Please sign in to comment.