Skip to content

Commit

Permalink
Improve backwards compatibility with Promise v1
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Feb 8, 2018
1 parent 245c40f commit ce9b58b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"php": ">=5.4.0",
"evenement/evenement": "^3.0 || ^2.0",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",
"react/promise": "^2.1 || ^1.2.1",
"react/socket": "^1.0 || ^0.8.4",
"react/stream": "^1.0 || ^0.7.1",
"react/promise": "~2.2",
"ringcentral/psr7": "^1.2"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private function writeHead()
$pendingWrites = &$this->pendingWrites;

$promise = $this->connect();
$promise->done(
$promise->then(
function (ConnectionInterface $stream) use ($requestData, &$streamRef, &$stateRef, &$pendingWrites) {
$streamRef = $stream;

Expand Down
19 changes: 0 additions & 19 deletions tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,25 +272,6 @@ public function requestShouldEmitErrorIfUrlHasNoScheme()
$request->end();
}

/**
* @test
* @expectedException Exception
* @expectedExceptionMessage something failed
*/
public function requestDoesNotHideErrors()
{
$requestData = new RequestData('GET', 'http://www.example.com');
$request = new Request($this->connector, $requestData);

$this->rejectedConnectionMock();

$request->on('error', function () {
throw new \Exception('something failed');
});

$request->end();
}

/** @test */
public function postRequestShouldSendAPostRequest()
{
Expand Down

0 comments on commit ce9b58b

Please sign in to comment.