Add curl extension loaded test

This commit is contained in:
php-curl-class
2013-08-19 14:15:10 -07:00
parent 09a6c3b667
commit 2b0401c520
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -3,6 +3,10 @@ class Curl {
const USER_AGENT = 'PHP-Curl-Class/1.0 (+https://github.com/php-curl-class/php-curl-class)';
function __construct() {
if (!extension_loaded('curl')) {
throw new ErrorException('cURL library is not loaded');
}
$this->curl = curl_init();
$this->setUserAgent(self::USER_AGENT);
$this->setopt(CURLOPT_RETURNTRANSFER, TRUE);
+4
View File
@@ -24,6 +24,10 @@ class Test {
}
class CurlTest extends PHPUnit_Framework_TestCase {
public function testExtensionLoaded() {
$this->assertTrue(extension_loaded('curl'));
}
public function testUserAgent() {
$test = new Test();
$test->curl->setUserAgent(Curl::USER_AGENT);