Skip to content

Commit

Permalink
Improve test suite to support PHPUnit 7, PHP 7.3 and fix incomplete test
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Jun 22, 2019
1 parent de1ef83 commit 302f2e1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ php:
- 7.0
- 7.1
- 7.2
- 7.3
- hhvm # ignore errors, see below

# lock distro so new future defaults will not break the build
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
},
"require": {
"php": ">=5.3",
"react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4 || ^0.3",
"react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4.6",
"react/promise": "^2.1 || ^1.2"
},
"require-dev": {
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",
"react/promise-timer": "^1.0",
"clue/block-react": "^1.0",
"phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35"
"phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35"
}
}
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
convertWarningsToExceptions="true"
>
<testsuites>
<testsuite>
<testsuite name="PromiseStream Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
Expand Down
16 changes: 6 additions & 10 deletions tests/UnwrapWritableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,24 +318,20 @@ public function testClosingStreamWillCloseInputStream()

public function testClosingStreamWillCloseStreamIfItIgnoredCancellationAndResolvesLater()
{
$this->markTestIncomplete();

$input = new ThroughStream();
$input->on('close', $this->expectCallableOnce());

$loop = $this->loop;
$promise = new Promise\Promise(function ($resolve) use ($loop, $input) {
$loop->addTimer(0.001, function () use ($resolve, $input) {
$resolve($input);
});
});
$deferred = new Deferred();

$stream = Stream\unwrapReadable($promise);
$stream = Stream\unwrapReadable($deferred->promise());

$stream->on('close', $this->expectCallableOnce());

$stream->close();

Block\await($promise, $this->loop);
$this->assertTrue($input->isReadable());

$deferred->resolve($input);

$this->assertFalse($input->isReadable());
}
Expand Down

0 comments on commit 302f2e1

Please sign in to comment.