Skip to content

Commit b491881

Browse files
committed
Update to clue/buzz-react:0.5
1 parent 98b7e59 commit b491881

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"php": ">=5.3",
1818
"react/event-loop": "~0.4.0|~0.3.0",
1919
"react/promise": "~2.1|~1.1",
20-
"clue/buzz-react": "~0.4.1",
20+
"clue/buzz-react": "^0.5",
2121
"ext-simplexml": "*",
2222
"neitanod/forceutf8": "~1.4",
2323
"rize/uri-template": "^0.3"

src/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use SimpleXMLElement;
88
use InvalidArgumentException;
99
use Clue\React\Buzz\Browser;
10-
use Clue\React\Buzz\Message\Response;
10+
use Psr\Http\Message\ResponseInterface;
1111
use React\Promise;
1212
use Clue\React\ViewVcApi\Io\Parser;
1313
use Clue\React\ViewVcApi\Io\Loader;
@@ -156,7 +156,7 @@ private function fetchXml($url)
156156
private function fetch($url)
157157
{
158158
return $this->browser->get($url)->then(
159-
function (Response $response) {
159+
function (ResponseInterface $response) {
160160
return (string)$response->getBody();
161161
},
162162
function ($error) {

tests/ClientTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?php
22

33
use Clue\React\ViewVcApi\Client;
4-
use Clue\React\Buzz\Message\Response;
5-
use Clue\React\Buzz\Message\Body;
64
use React\Promise;
75
use Clue\React\Buzz\Browser;
8-
use Clue\React\Buzz\Message\Request;
6+
use Psr\Http\Message\RequestInterface;
7+
use RingCentral\Psr7\Response;
98

109
class ClientTest extends TestCase
1110
{
@@ -36,7 +35,7 @@ public function testInvalidFile()
3635

3736
public function testFetchFile()
3837
{
39-
$response = new Response('HTTP/1.0', 200, 'OK', array(), new Body('# hello'));
38+
$response = new Response(200, array(), '# hello', '1.0', 'OK');
4039

4140
$this->expectRequest($this->uri . 'README.md?view=co')->will($this->returnValue(Promise\resolve($response)));
4241

@@ -112,7 +111,7 @@ private function expectRequest($uri)
112111
{
113112
$that = $this;
114113

115-
return $this->sender->expects($this->once())->method('send')->with($this->callback(function (Request $request) use ($that, $uri) {
114+
return $this->sender->expects($this->once())->method('send')->with($this->callback(function (RequestInterface $request) use ($that, $uri) {
116115
$that->assertEquals('GET', $request->getMethod());
117116
$that->assertEquals($uri, $request->getUri());
118117

tests/FunctionalGentooClientTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use React\EventLoop\Factory as LoopFactory;
55
use Clue\React\Buzz\Browser;
66
use Clue\React\Block;
7+
use Clue\React\Buzz\Message\ResponseException;
78

89
class FunctionalGentooClientTest extends TestCase
910
{
@@ -22,18 +23,18 @@ public function setUp()
2223
$browser = new Browser($this->loop);
2324

2425
// check connectivity to given URL only once
25-
static $checked = null;
26-
if ($checked === null) {
26+
static $error = null;
27+
if ($error === null) {
2728
try {
28-
Block\await($browser->head($url), $this->loop);
29-
$checked = true;
29+
Block\await($browser->get($url), $this->loop);
30+
$error = false;
3031
} catch (Exception $e) {
31-
$checked = false;
32+
$error = $e->getMessage();
3233
}
3334
}
3435

35-
if (!$checked) {
36-
$this->markTestSkipped('Unable to reach Gentoo ViewVC');
36+
if ($error !== false) {
37+
$this->markTestSkipped('Unable to reach Gentoo ViewVC: ' . $error);
3738
}
3839

3940
$this->viewvc = new Client($browser->withBase($url));

0 commit comments

Comments
 (0)