-
Notifications
You must be signed in to change notification settings - Fork 0
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
8edb066
commit 53592fc
Showing
5 changed files
with
109 additions
and
15 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
language: php | ||
php: | ||
- '5.6' | ||
- '7.1' | ||
notifications: | ||
email: false | ||
install: | ||
- composer self-update | ||
- composer update --prefer-dist | ||
script: | ||
- phpunit tests/ |
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
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
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
require_once('src/TestingBot/TestingBotAPI.php'); | ||
|
||
class TestingBotTest extends PHPUnit_Framework_TestCase { | ||
private $api; | ||
|
||
public function setup() { | ||
$key = getenv("TB_KEY"); | ||
$secret = getenv("TB_SECRET"); | ||
|
||
$this->api = new TestingBot\TestingBotAPI($key, $secret); | ||
} | ||
|
||
public function testGetSingleTest() { | ||
$sessionID = "6344353dcee24694bf39d5ee5e6e5b11"; | ||
$test = $this->api->getJob($sessionID); | ||
$this->assertEquals($test['session_id'], $sessionID); | ||
} | ||
|
||
public function testGetUnknownTest() { | ||
$sessionID = "unknown"; | ||
$test = $this->api->getJob($sessionID); | ||
$this->assertArrayHasKey('error', $test); | ||
} | ||
|
||
public function testDeleteUnknownTest() { | ||
$sessionID = "unknown"; | ||
$test = $this->api->deleteJob($sessionID); | ||
$this->assertArrayHasKey('error', $test); | ||
} | ||
|
||
public function testGetTests() { | ||
$tests = $this->api->getJobs(0, 10); | ||
$this->assertCount(10, $tests['data']); | ||
} | ||
|
||
public function testGetUser() { | ||
$user = $this->api->getUserInfo(); | ||
$this->assertEquals("bot", $user['last_name']); | ||
} | ||
|
||
public function testUnauthorizedCall() { | ||
try { | ||
$api = new TestingBot\TestingBotAPI('', ''); | ||
$user = $api->getUserInfo(); | ||
$this->assertEquals(true, false); | ||
} catch (Exception $e) { | ||
$this->assertEquals(true, true); | ||
} | ||
} | ||
|
||
public function testGetTunnels() { | ||
$tunnels = $this->api->getTunnels(); | ||
$this->assertCount(0, $tunnels); | ||
} | ||
|
||
public function testGetBrowsers() { | ||
$browsers = $this->api->getBrowsers(); | ||
$this->assertEquals(sizeof($browsers) > 0, true); | ||
} | ||
|
||
public function testCalculateAuthentication() { | ||
$this->assertEquals($this->api->getAuthenticationHash("test"), "344ebf07233168c4882adf953a8a8c9b"); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.