Skip to content

Commit 746fc3d

Browse files
committed
Add 100% coverage for response.php
While already at #2911 I thought I can as well finish that one as well... Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
1 parent 60a8a1a commit 746fc3d

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

tests/lib/Http/Client/ResponseTest.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Test\Http\Client;
1010

11-
use Guzzle\Stream\Stream;
11+
use GuzzleHttp\Stream\Stream;
1212
use GuzzleHttp\Message\Response as GuzzleResponse;
1313
use OC\Http\Client\Response;
1414

@@ -27,12 +27,33 @@ public function setUp() {
2727
$this->response = new Response($this->guzzleResponse);
2828
}
2929

30+
public function testGetBody() {
31+
$this->guzzleResponse->setBody(Stream::factory('MyResponse'));
32+
$this->assertSame('MyResponse', $this->response->getBody());
33+
}
34+
3035
public function testGetStatusCode() {
31-
$this->assertEquals(1337, $this->response->getStatusCode());
36+
$this->assertSame(1337, $this->response->getStatusCode());
3237
}
3338

3439
public function testGetHeader() {
3540
$this->guzzleResponse->setHeader('bar', 'foo');
36-
$this->assertEquals('foo', $this->response->getHeader('bar'));
41+
$this->assertSame('foo', $this->response->getHeader('bar'));
42+
}
43+
44+
public function testGetHeaders() {
45+
$this->guzzleResponse->setHeader('bar', 'foo');
46+
$this->guzzleResponse->setHeader('x-awesome', 'yes');
47+
48+
$expected = [
49+
'bar' => [
50+
0 => 'foo',
51+
],
52+
'x-awesome' => [
53+
0 => 'yes',
54+
],
55+
];
56+
$this->assertSame($expected, $this->response->getHeaders());
57+
$this->assertSame('yes', $this->response->getHeader('x-awesome'));
3758
}
3859
}

0 commit comments

Comments
 (0)