8000 Run tests on PHPUnit 9 and clean up test suite by SimonFrings · Pull Request #212 · reactphp/event-loop · GitHub
[go: up one dir, main page]

Skip to content

Run tests on PHPUnit 9 and clean up test suite #212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Run tests on PHPUnit 9
  • Loading branch information
SimonFrings committed Jul 17, 2020
commit 02c6c530e9f5c93c0f25d8655de261f5ac44c854
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
10000 Expand Down
9 changes: 8 additions & 1 deletion tests/AbstractLoopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions tests/CallableStub.php

This file was deleted.

5 changes: 4 additions & 1 deletion tests/ExtLibeventLoopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ public function createLoop()
return new ExtLibeventLoop();
}

public function tearDown()
/**
* @after
*/
public function tearDownFile()
{
if (file_exists($this->fifoPath)) {
unlink($this->fifoPath);
Expand Down
5 changes: 4 additions & 1 deletion tests/StreamSelectLoopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down
8 changes: 7 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
0