Skip to content

Commit 0f9746a

Browse files
authored
Merge pull request #22 from SimonFrings/tests
Run test on PHPUnit 9, run tests on PHP 7.4, simplify test matrix and clean up test suite
2 parents a80b842 + ab4126f commit 0f9746a

File tree

7 files changed

+28
-35
lines changed

7 files changed

+28
-35
lines changed

.travis.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
language: php
22

3-
php:
4-
# - 5.3 # requires old distro, see below
5-
- 5.4
6-
- 5.5
7-
- 5.6
8-
- 7.0
9-
- 7.1
10-
- 7.2
11-
- 7.3
12-
- hhvm # ignore errors, see below
13-
143
# lock distro so new future defaults will not break the build
154
dist: trusty
165

17-
matrix:
6+
jobs:
187
include:
198
- php: 5.3
209
dist: precise
10+
- php: 5.4
11+
- php: 5.5
12+
- php: 5.6
13+
- php: 7.0
14+
- php: 7.1
15+
- php: 7.2
16+
- php: 7.3
17+
- php: 7.4
18+
- php: hhvm-3.18
2119
allow_failures:
22-
- php: hhvm
23-
24-
sudo: false
20+
- php: hhvm-3.18
2521

2622
install:
2723
- composer install --no-interaction

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",
2727
"react/promise-timer": "^1.0",
2828
"clue/block-react": "^1.0",
29-
"phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35"
29+
"phpunit/phpunit": "^9.0 || ^5.7 || ^4.8.35"
3030
}
3131
}

phpunit.xml.dist

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<phpunit bootstrap="vendor/autoload.php"
4-
colors="true"
5-
convertErrorsToExceptions="true"
6-
convertNoticesToExceptions="true"
7-
convertWarningsToExceptions="true"
8-
>
3+
<phpunit bootstrap="vendor/autoload.php" colors="true">
94
<testsuites>
105
<testsuite name="PromiseStream Test Suite">
116
<directory>./tests/</directory>

tests/CallableStub.php

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/TestCase.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ protected function expectCallableNever()
5353
*/
5454
protected function createCallableMock()
5555
{
56-
return $this->getMockBuilder('React\Tests\Promise\Stream\CallableStub')->getMock();
56+
if (method_exists('PHPUnit\Framework\MockObject\MockBuilder', 'addMethods')) {
57+
// PHPUnit 9+
58+
return $this->getMockBuilder('stdClass')->addMethods(array('__invoke'))->getMock();
59+
} else {
60+
// legacy PHPUnit 4 - PHPUnit 9
61+
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
62+
}
5763
}
5864

5965
protected function expectPromiseResolve($promise)

tests/UnwrapReadableTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ class UnwrapReadableTest extends TestCase
1313
{
1414
private $loop;
1515

16-
public function setUp()
16+
/**
17+
* @before
18+
*/
19+
public function setUpLoop()
1720
{
1821
$this->loop = Factory::create();
1922
}

tests/UnwrapWritableTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ class UnwrapWritableTest extends TestCase
1414
{
1515
private $loop;
1616

17-
public function setUp()
17+
/**
18+
* @before
19+
*/
20+
public function setUpLoop()
1821
{
1922
$this->loop = Factory::create();
2023
}

0 commit comments

Comments
 (0)