|
3 | 3 | namespace Github\Tests\Api;
|
4 | 4 |
|
5 | 5 | use Github\Api\AbstractApi;
|
| 6 | +use Guzzle\Http\Message\Response; |
6 | 7 |
|
7 | 8 | class AbstractApiTest extends \PHPUnit_Framework_TestCase
|
8 | 9 | {
|
@@ -111,6 +112,26 @@ public function shouldPassDELETERequestToClient()
|
111 | 112 | $this->assertEquals($expectedArray, $api->delete('/path', array('param1' => 'param1value'), array('option1' => 'option1value')));
|
112 | 113 | }
|
113 | 114 |
|
| 115 | + /** |
| 116 | + * @test |
| 117 | + */ |
| 118 | + public function shouldNotPassEmptyRefToClient() |
| 119 | + { |
| 120 | + $expectedResponse = new Response('value'); |
| 121 | + |
| 122 | + $httpClient = $this->getHttpMock(); |
| 123 | + $httpClient |
| 124 | + ->expects($this->any()) |
| 125 | + ->method('get') |
| 126 | + ->with('/path', array()) |
| 127 | + ->will($this->returnValue($expectedResponse)); |
| 128 | + $client = $this->getClientMock(); |
| 129 | + $client->setHttpClient($httpClient); |
| 130 | + |
| 131 | + $api = new ExposedAbstractApiTestInstance($client); |
| 132 | + $api->get('/path', array('ref' => null)); |
| 133 | + } |
| 134 | + |
114 | 135 | protected function getAbstractApiObject($client)
|
115 | 136 | {
|
116 | 137 | return new AbstractApiTestInstance($client);
|
@@ -193,3 +214,14 @@ public function delete($path, array $parameters = array(), $requestHeaders = arr
|
193 | 214 | return $this->client->getHttpClient()->delete($path, $parameters, $requestHeaders);
|
194 | 215 | }
|
195 | 216 | }
|
| 217 | + |
| 218 | +class ExposedAbstractApiTestInstance extends AbstractApi |
| 219 | +{ |
| 220 | + /** |
| 221 | + * {@inheritDoc} |
| 222 | + */ |
| 223 | + public function get($path, array $parameters = array(), $requestHeaders = array()) |
| 224 | + { |
| 225 | + return parent::get($path, $parameters, $requestHeaders); |
| 226 | + } |
| 227 | +} |
0 commit comments