Skip to content

Commit 583b98a

Browse files
committed
Forward compatibility with upcoming Stream v1.0 through old v0.4
1 parent 6f191e0 commit 583b98a

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"guzzlehttp/psr7": "^1.0",
99
"react/socket": "^0.7",
1010
"react/event-loop": "0.4.*",
11-
"react/stream": "^0.5|^0.6",
11+
"react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4.2",
1212
"react/promise": "~2.2",
1313
"evenement/evenement": "~2.0"
1414
},

tests/RequestTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use React\HttpClient\Request;
66
use React\HttpClient\RequestData;
77
use React\Stream\Stream;
8+
use React\Stream\DuplexResourceStream;
89
use React\Promise\RejectedPromise;
910
use React\Promise\Deferred;
1011
use React\Promise\Promise;
@@ -428,7 +429,7 @@ public function pipeShouldPipeDataIntoTheRequestBody()
428429
$request->setResponseFactory($factory);
429430

430431
$stream = fopen('php://memory', 'r+');
431-
$stream = new Stream($stream, $loop);
432+
$stream = class_exists('React\Stream\DuplexResourceStream') ? new DuplexResourceStream($stream, $loop) : new Stream($stream, $loop);
432433

433434
$stream->pipe($request);
434435
$stream->emit('data', array('some'));

tests/ResponseTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ class ResponseTest extends TestCase
1111

1212
public function setUp()
1313
{
14-
$this->stream = $this->getMockBuilder('React\Stream\Stream')
15-
->disableOriginalConstructor()
14+
$this->stream = $this->getMockBuilder('React\Stream\DuplexStreamInterface')
1615
->getMock();
1716
}
1817

0 commit comments

Comments
 (0)