File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55use Clue \React \Ami \Protocol \Event ;
66use Clue \React \Ami \Protocol \Action ;
77use Evenement \EventEmitter ;
8- use React \Stream \StreamInterface ;
8+ use React \Stream \Stream ;
99use Clue \React \Ami \Protocol \Parser ;
1010use React \Promise \Deferred ;
1111use Exception ;
@@ -20,7 +20,7 @@ class Client extends EventEmitter
2020 private $ pending = array ();
2121 private $ ending = false ;
2222
23- public function __construct (StreamInterface $ stream , Parser $ parser = null )
23+ public function __construct (Stream $ stream , Parser $ parser = null )
2424 {
2525 if ($ parser === null ) {
2626 $ parser = new Parser ();
Original file line number Diff line number Diff line change 33use React \Stream \Stream ;
44use Clue \React \Ami \Protocol \Parser ;
55use Clue \React \Ami \Client ;
6- use React \Stream \ ThroughStream ;
6+ use React \EventLoop \ Factory ;
77
88class ClientTest extends TestCase
99{
1010 public function testClosingStreamClosesClient ()
1111 {
12- $ stream = new ThroughStream ();
12+ $ stream = $ this -> createStreamMock ();
1313
1414 $ client = new Client ($ stream );
1515
@@ -21,7 +21,7 @@ public function testClosingStreamClosesClient()
2121
2222 public function testParserExceptionForwardsErrorAndClosesClient ()
2323 {
24- $ stream = new ThroughStream ();
24+ $ stream = $ this -> createStreamMock ();
2525 $ parser = new Parser ();
2626
2727 $ client = new Client ($ stream , $ parser );
@@ -31,4 +31,9 @@ public function testParserExceptionForwardsErrorAndClosesClient()
3131
3232 $ stream ->emit ('data ' , array ("invalid chunk \r\n\r\ninvalid chunk \r\n\r\n" ));
3333 }
34+
35+ private function createStreamMock ()
36+ {
37+ return new Stream (fopen ('php://memory ' , 'r+ ' ), $ this ->getMock ('React\EventLoop\LoopInterface ' ));
38+ }
3439}
You can’t perform that action at this time.
0 commit comments