Skip to content
This repository has been archived by the owner on Nov 2, 2022. It is now read-only.

Commit

Permalink
Added unit tests for the API class
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesryanbell committed Aug 10, 2014
1 parent 78e6ab8 commit 612b61c
Showing 1 changed file with 47 additions and 10 deletions.
57 changes: 47 additions & 10 deletions tests/ApiTest.php
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]);
}

}

0 comments on commit 612b61c

Please sign in to comment.