Skip to content

Commit

Permalink
Add test for fix in #9630
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Oct 20, 2016
1 parent 5e3b297 commit aca66f9
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/TestCase/Network/Http/ClientTest.php
Expand Up @@ -193,6 +193,40 @@ public function testGetSimpleWithHeadersAndCookies()
$this->assertSame($result, $response);
}

/**
* test get request with no data
*
* @return void
*/
public function testGetNoData()
{
$response = new Response();

$mock = $this->getMockBuilder('Cake\Http\Client\Adapter\Stream')
->setMethods(['send'])
->getMock();
$mock->expects($this->once())
->method('send')
->with($this->callback(function ($request) {
$this->assertEquals(Request::METHOD_GET, $request->getMethod());
$this->assertEmpty($request->getHeaderLine('Content-Type'), 'Should have no content-type set');
$this->assertEquals(
'http://cakephp.org/search',
$request->getUri() . ''
);

return true;
}))
->will($this->returnValue([$response]));

$http = new Client([
'host' => 'cakephp.org',
'adapter' => $mock
]);
$result = $http->get('/search');
$this->assertSame($result, $response);
}

/**
* test get request with querystring data
*
Expand Down

0 comments on commit aca66f9

Please sign in to comment.