Code style fixes

This commit is contained in:
Dmitry Khomutov 2016-04-21 23:06:58 +06:00
commit 8e970853f6
7 changed files with 539 additions and 561 deletions

View file

@ -6,59 +6,59 @@ use b8\HttpClient;
class HttpClientTest extends \PHPUnit_Framework_TestCase
{
public function testSimpleRequest()
{
$http = new HttpClient();
$html = $http->request('GET', 'https://www.cloudflare.com/');
public function testSimpleRequest()
{
$http = new HttpClient();
$html = $http->request('GET', 'https://www.cloudflare.com/');
$this->assertContains('CloudFlare', $html['body']);
}
$this->assertContains('CloudFlare', $html['body']);
}
public function testBaseUrl()
{
$http = new HttpClient('https://www.cloudflare.com');
$html = $http->request('GET', '/');
public function testBaseUrl()
{
$http = new HttpClient('https://www.cloudflare.com');
$html = $http->request('GET', '/');
$this->assertContains('CloudFlare', $html['body']);
}
$this->assertContains('CloudFlare', $html['body']);
}
public function testGet()
{
$http = new HttpClient('https://www.cloudflare.com');
$html = $http->get('overview', ['x' => 1]);
public function testGet()
{
$http = new HttpClient('https://www.cloudflare.com');
$html = $http->get('overview', ['x' => 1]);
$this->assertContains('CloudFlare', $html['body']);
}
$this->assertContains('CloudFlare', $html['body']);
}
public function testGetJson()
{
$http = new HttpClient('http://echo.jsontest.com');
$data = $http->get('/key/value');
public function testGetJson()
{
$http = new HttpClient('http://echo.jsontest.com');
$data = $http->get('/key/value');
$this->assertArrayHasKey('key', $data['body']);
}
$this->assertArrayHasKey('key', $data['body']);
}
public function testPost()
{
$http = new HttpClient('http://echo.jsontest.com');
$data = $http->post('/key/value', ['test' => 'x']);
public function testPost()
{
$http = new HttpClient('http://echo.jsontest.com');
$data = $http->post('/key/value', ['test' => 'x']);
$this->assertTrue(is_array($data));
}
$this->assertTrue(is_array($data));
}
public function testPut()
{
$http = new HttpClient('http://echo.jsontest.com');
$data = $http->put('/key/value', ['test' => 'x']);
public function testPut()
{
$http = new HttpClient('http://echo.jsontest.com');
$data = $http->put('/key/value', ['test' => 'x']);
$this->assertTrue(is_array($data));
}
$this->assertTrue(is_array($data));
}
public function testDelete()
{
$http = new HttpClient('http://echo.jsontest.com');
$data = $http->delete('/key/value', ['test' => 'x']);
public function testDelete()
{
$http = new HttpClient('http://echo.jsontest.com');
$data = $http->delete('/key/value', ['test' => 'x']);
$this->assertTrue(is_array($data));
}
$this->assertTrue(is_array($data));
}
}