Refactored structure
This commit is contained in:
parent
963225382c
commit
e5164ae1dd
329 changed files with 277 additions and 457 deletions
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once(dirname(__FILE__) . '/../b8/Registry.php');
|
||||
require_once(dirname(__FILE__) . '/../b8/HttpClient.php');
|
||||
|
||||
use b8\Registry,
|
||||
b8\HttpClient;
|
||||
|
||||
class HttpClientTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testSimpleRequest()
|
||||
{
|
||||
$http = new HttpClient();
|
||||
$html = $http->request('GET', 'https://www.cloudflare.com/');
|
||||
|
||||
$this->assertContains('CloudFlare', $html['body']);
|
||||
}
|
||||
|
||||
public function testBaseUrl()
|
||||
{
|
||||
$http = new HttpClient('https://www.cloudflare.com');
|
||||
$html = $http->request('GET', '/');
|
||||
|
||||
$this->assertContains('CloudFlare', $html['body']);
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
$http = new HttpClient('https://www.cloudflare.com');
|
||||
$html = $http->get('overview', array('x' => 1));
|
||||
|
||||
$this->assertContains('CloudFlare', $html['body']);
|
||||
}
|
||||
|
||||
public function testGetJson()
|
||||
{
|
||||
$http = new HttpClient('http://echo.jsontest.com');
|
||||
$data = $http->get('/key/value');
|
||||
|
||||
$this->assertArrayHasKey('key', $data['body']);
|
||||
}
|
||||
|
||||
public function testPost()
|
||||
{
|
||||
$http = new HttpClient('http://echo.jsontest.com');
|
||||
$data = $http->post('/key/value', array('test' => 'x'));
|
||||
|
||||
$this->assertTrue(is_array($data));
|
||||
}
|
||||
|
||||
public function testPut()
|
||||
{
|
||||
$http = new HttpClient('http://echo.jsontest.com');
|
||||
$data = $http->put('/key/value', array('test' => 'x'));
|
||||
|
||||
$this->assertTrue(is_array($data));
|
||||
}
|
||||
|
||||
public function testDelete()
|
||||
{
|
||||
$http = new HttpClient('http://echo.jsontest.com');
|
||||
$data = $http->delete('/key/value', array('test' => 'x'));
|
||||
|
||||
$this->assertTrue(is_array($data));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue