8000 Update to clue/buzz-react:0.5 · clue/reactphp-packagist-api@393ce26 · GitHub
[go: up one dir, main page]

Skip to content

Commit 393ce26

Browse files
committed
Update to clue/buzz-react:0.5
1 parent dc65913 commit 393ce26

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"require": {
1414
"php": ">=5.3",
1515
"knplabs/packagist-api": "~1.0",
16-
"clue/buzz-react": "~0.1.0|~0.2.0"
16+
"clue/buzz-react": "^0.5"
1717
},
1818
"autoload": {
1919
"psr-4": { "Clue\\React\\Packagist\\Api\\": "src/" }

src/Client.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Packagist\Api\Result\Factory;
66
use Clue\React\Buzz\Browser;
7-
use Clue\React\Buzz\Message\Response;
7+
use Psr\Http\Message\ResponseInterface;
88

99
class Client
1010
{
@@ -30,7 +30,7 @@ public function search($query, array $filters = array())
3030
$that = $this;
3131

3232
$fetch = function ($url) use (&$results, $that, &$fetch) {
33-
return $that->request($url)->then(function (Response $response) use (&$results, $that, $fetch) {
33+
return $that->request($url)->then(function (ResponseInterface $response) use (&$results, $that, $fetch) {
3434
$parsed = $that->parse((string)$response->getBody());
3535
$results = array_merge($results, $that->create($parsed));
3636

@@ -70,7 +70,7 @@ protected function respond($url)
7070
$response = $this->request($url);
7171
$that = $this;
7272

73-
return $response->then(function (Response $response) use ($that) {
73+
return $response->then(function (ResponseInterface $response) use ($that) {
7474
return $that->create($that->parse((string)$response->getBody()));
7575
});
7676
}

tests/ClientTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
use Clue\React\Packagist\Api\Client;
44
use React\Promise\Deferred;
5-
use Clue\React\Buzz\Message\Response;
6-
use Clue\React\Buzz\Message\Headers;
7-
use Clue\React\Buzz\Message\Body;
5+
use RingCentral\Psr7\Response;
6+
use React\Promise;
87

98
class ClientTest extends TestCase
109
{
@@ -75,9 +74,10 @@ private function setupBrowser($expectedUrl, $promise)
7574

7675
private function createResponsePromise($fakeResponseBody)
7776
{
78-
$d = new Deferred();
79-
$d->resolve(new Response('HTTP/1.0', 200, 'OK', new Headers(), new Body($fakeResponseBody)));
80-
return $d->promise();
77+
$response = $this->getMock('Psr\Http\Message\ResponseInterface');
78+
$response->expects($this->once())->method('getBody')->willReturn($fakeResponseBody);
79+
80+
return Promise\resolve($response);
8181
}
8282

8383
private function createRejectedPromise($reason)

0 commit comments

Comments
 (0)
0