version 0.3
This commit is contained in:
29
test/mashape/http/HttpClientTest.php
Normal file
29
test/mashape/http/HttpClientTest.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
require_once(MASHAPE_CLIENT_LIBRAY_PATH . "/http/HttpClient.php");
|
||||
|
||||
class HttpClientTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
function testDoRequest() {
|
||||
|
||||
try {
|
||||
HttpClient::doRequest("ciao", "http://www.ciao.com", null, null);
|
||||
$this->assertFalse(true);
|
||||
} catch (MashapeClientException $e) {
|
||||
$this->assertEquals(1003, $e->getCode());
|
||||
}
|
||||
|
||||
try {
|
||||
HttpClient::doRequest(HttpMethod::GET, "http://www.google.com", null, null);
|
||||
$this->assertFalse(true);
|
||||
} catch (MashapeClientException $e) {
|
||||
$this->assertEquals(2000, $e->getCode());
|
||||
}
|
||||
|
||||
$response = HttpClient::doRequest(HttpMethod::POST, "https://api.mashape.com/requestToken", null, null);
|
||||
$this->assertEquals(2001, $response->errors[0]->code);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user