Ejemplo n.º 1
0
 public function testCancelConnectionDuringSessionWillCloseStream()
 {
     $stream = $this->getMockBuilder('React\\Stream\\Stream')->disableOriginalConstructor()->getMock();
     $stream->expects($this->once())->method('close');
     $promise = new Promise(function ($resolve) use($stream) {
         $resolve($stream);
     });
     $this->connector->expects($this->once())->method('create')->with('127.0.0.1', 1080)->willReturn($promise);
     $promise = $this->client->create('google.com', 80);
     $promise->cancel();
     $this->expectPromiseReject($promise);
 }