This repository has been archived by the owner on Nov 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78e6ab8
commit 612b61c
Showing
1 changed file
with
47 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,50 @@ | ||
<?php | ||
|
||
use JamesRyanBell\Cloudflare; | ||
|
||
class CloudflareTest extends PHPUnit_Framework_TestCase { | ||
|
||
public function testApiClassFound() | ||
{ | ||
$api = new Cloudflare\Api; | ||
$this->assertTrue((bool)$api); | ||
} | ||
|
||
|
||
class ApiTest extends PHPUnit_Framework_TestCase { | ||
|
||
public function testApiClassFound() | ||
{ | ||
$api = new Cloudflare\Api; | ||
$this->assertTrue((bool)$api); | ||
} | ||
|
||
public function testApiInitialised() | ||
{ | ||
$api = new Cloudflare\Api('email@example.com', 'Auth Key'); | ||
$this->assertEquals('email@example.com', $api->email); | ||
$this->assertEquals('Auth Key', $api->auth_key); | ||
} | ||
|
||
public function testApiInitialisedFromPreviousObject() | ||
{ | ||
$client = new Cloudflare\Api('email@example.com', 'Auth Key'); | ||
$api = new Cloudflare\Api($client); | ||
$this->assertEquals('email@example.com', $api->email); | ||
$this->assertEquals('Auth Key', $api->auth_key); | ||
} | ||
|
||
public function testSetAuthKey() | ||
{ | ||
$api = new Cloudflare\Api; | ||
$api->setAuthKey('Auth Key'); | ||
$this->assertEquals('Auth Key', $api->auth_key); | ||
} | ||
|
||
public function testSetEmail() | ||
{ | ||
$api = new Cloudflare\Api; | ||
$api->setEmail('email@example.com'); | ||
$this->assertEquals('email@example.com', $api->email); | ||
} | ||
|
||
public function testSetCurlOption() | ||
{ | ||
$api = new Cloudflare\Api; | ||
$api->setCurlOption(array(CURLOPT_TIMEOUT => 5)); | ||
$this->assertArrayHasKey(CURLOPT_TIMEOUT, $api->curl_options); | ||
$this->assertEquals(5, $api->curl_options[CURLOPT_TIMEOUT]); | ||
} | ||
|
||
} |