diff --git a/.travis.yml b/.travis.yml index be4e6a06..4a99e2a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: php # lock distro so new future defaults will not break the build dist: xenial -matrix: +jobs: include: - php: 5.3 dist: precise @@ -24,7 +24,7 @@ matrix: dist: trusty before_install: [] # skip libuv install: - - composer require phpunit/phpunit:^5 --dev --no-interaction # requires legacy phpunit & skip ./travis-init.sh + - composer install # skip ./travis-init.sh - name: "Windows" os: windows language: shell # no built-in php support @@ -66,8 +66,6 @@ matrix: - php: hhvm-3.18 - os: windows -sudo: false - addons: apt: packages: diff --git a/composer.json b/composer.json index cc6abf06..81cf1017 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35" + "phpunit/phpunit": "^9.0 || ^5.7 || ^4.8.35" }, "suggest": { "ext-event": "~1.0 for ExtEventLoop", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 04d426b5..0e947b87 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,15 +1,6 @@ - + ./tests/ diff --git a/tests/AbstractLoopTest.php b/tests/AbstractLoopTest.php index 9b55f959..292ffd1a 100644 --- a/tests/AbstractLoopTest.php +++ b/tests/AbstractLoopTest.php @@ -16,7 +16,10 @@ abstract class AbstractLoopTest extends TestCase const PHP_DEFAULT_CHUNK_SIZE = 8192; - public function setUp() + /** + * @before + */ + public function setUpLoop() { // It's a timeout, don't set it too low. Travis and other CI systems are slow. $this->tickTimeout = 0.02; @@ -111,6 +114,10 @@ public function testAddWriteStreamTriggersWhenSocketConnectionSucceeds() public function testAddWriteStreamTriggersWhenSocketConnectionRefused() { + if (defined('HHVM_VERSION')) { + $this->markTestSkipped('Not supported on HHVM'); + } + // first verify the operating system actually refuses the connection and no firewall is in place // use higher timeout because Windows retires multiple times and has a noticeable delay // @link https://stackoverflow.com/questions/19440364/why-do-failed-attempts-of-socket-connect-take-1-sec-on-windows diff --git a/tests/CallableStub.php b/tests/CallableStub.php deleted file mode 100644 index 913d403a..00000000 --- a/tests/CallableStub.php +++ /dev/null @@ -1,10 +0,0 @@ -fifoPath)) { unlink($this->fifoPath); diff --git a/tests/StreamSelectLoopTest.php b/tests/StreamSelectLoopTest.php index 2eb388f0..d6800c5e 100644 --- a/tests/StreamSelectLoopTest.php +++ b/tests/StreamSelectLoopTest.php @@ -7,7 +7,10 @@ class StreamSelectLoopTest extends AbstractLoopTest { - protected function tearDown() + /** + * @after + */ + protected function tearDownSignalHandlers() { parent::tearDown(); if (strncmp($this->getName(false), 'testSignal', 10) === 0 && extension_loaded('pcntl')) { diff --git a/tests/TestCase.php b/tests/TestCase.php index dbdd54ce..69b3b227 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -39,7 +39,13 @@ protected function expectCallableNever() protected function createCallableMock() { - return $this->getMockBuilder('React\Tests\EventLoop\CallableStub')->getMock(); + if (method_exists('PHPUnit\Framework\MockObject\MockBuilder', 'addMethods')) { + // PHPUnit 9+ + return $this->getMockBuilder('stdClass')->addMethods(array('__invoke'))->getMock(); + } else { + // legacy PHPUnit 4 - PHPUnit 9 + return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock(); + } } protected function tickLoop(LoopInterface $loop)