Skip to content

Commit 2d47cc2

Browse files
authored
Improve test suite to support PHPUnit 7, PHP 7.3 and fix incomple… (#16)
Improve test suite to support PHPUnit 7, PHP 7.3 and fix incomplete test
2 parents de1ef83 + 302f2e1 commit 2d47cc2

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ php:
88
- 7.0
99
- 7.1
1010
- 7.2
11+
- 7.3
1112
- hhvm # ignore errors, see below
1213

1314
# lock distro so new future defaults will not break the build

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
},
2020
"require": {
2121
"php": ">=5.3",
22-
"react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4 || ^0.3",
22+
"react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4.6",
2323
"react/promise": "^2.1 || ^1.2"
2424
},
2525
"require-dev": {
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": "^6.4 || ^5.7 || ^4.8.35"
29+
"phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35"
3030
}
3131
}

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
convertWarningsToExceptions="true"
88
>
99
<testsuites>
10-
<testsuite>
10+
<testsuite name="PromiseStream Test Suite">
1111
<directory>./tests/</directory>
1212
</testsuite>
1313
</testsuites>

tests/UnwrapWritableTest.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -318,24 +318,20 @@ public function testClosingStreamWillCloseInputStream()
318318

319319
public function testClosingStreamWillCloseStreamIfItIgnoredCancellationAndResolvesLater()
320320
{
321-
$this->markTestIncomplete();
322-
323321
$input = new ThroughStream();
322+
$input->on('close', $this->expectCallableOnce());
324323

325-
$loop = $this->loop;
326-
$promise = new Promise\Promise(function ($resolve) use ($loop, $input) {
327-
$loop->addTimer(0.001, function () use ($resolve, $input) {
328-
$resolve($input);
329-
});
330-
});
324+
$deferred = new Deferred();
331325

332-
$stream = Stream\unwrapReadable($promise);
326+
$stream = Stream\unwrapReadable($deferred->promise());
333327

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

336330
$stream->close();
337331

338-
Block\await($promise, $this->loop);
332+
$this->assertTrue($input->isReadable());
333+
334+
$deferred->resolve($input);
339335

340336
$this->assertFalse($input->isReadable());
341337
}

0 commit comments

Comments
 (0)