Ejemplo n.º 1
0
 public function testSettings()
 {
     if (!$this->doTest(__FUNCTION__)) {
         return;
     }
     $version = GoCoin::getVersion();
     $mode = GoCoin::getApiMode();
     echo '[DEBUG]: VERSION: ' . $version . "\n";
     echo '[DEBUG]: API MODE: ' . $mode . "\n";
     echo '[DEBUG]: CLIENT_ID: ' . CLIENT_ID . "\n";
     echo '[DEBUG]: CLIENT_SECRET: ' . CLIENT_SECRET . "\n";
     echo '[DEBUG]: TOKEN: ' . TOKEN . "\n";
     //verify test settings
     $client = GoCoin::getClient(TOKEN);
     echo '[WARNING]: ==== Settings for [' . $mode . "] ====\n";
     echo '[DEBUG]: API URL: ' . $client->options['host'] . "\n";
     echo '[DEBUG]: DASHBOARD URL: ' . $client->options['dashboard_host'] . "\n";
     //assertions
     $this->assertEquals($client->options['host'], GoCoin::PRODUCTION_HOST);
     $this->assertEquals($client->options['dashboard_host'], GoCoin::PRODUCTION_DASHBOARD_HOST);
     //verify test settings
     $mode = GoCoin::setApiMode('test');
     $client = GoCoin::getClient(TOKEN);
     echo '[WARNING]: ==== Settings for [' . $mode . "] ====\n";
     echo '[DEBUG]: API URL: ' . $client->options['host'] . "\n";
     echo '[DEBUG]: DASHBOARD URL: ' . $client->options['dashboard_host'] . "\n";
     //assertions
     $this->assertEquals($client->options['host'], GoCoin::TEST_HOST);
     $this->assertEquals($client->options['dashboard_host'], GoCoin::TEST_DASHBOARD_HOST);
     //make sure we're at the expected client library version
     $this->assertEquals($version, GoCoinTest::EXPECTED_LIBRARY_VERSION);
     //make sure to put the mode back to test for the rest of the tests
     $mode = GoCoin::setApiMode('test');
 }
Ejemplo n.º 2
0
require_once __DIR__ . '/../src/GoCoin.php';
//pick a token
$token = $TOKENS['full_access'];
//echo an HTML block
echo '<html><head><title>GoCoin User Test</title></head><body>' . "\n";
//get the current user
$user = GoCoin::getUser($token);
//get a specific user
$specific = GoCoin::getUser($token, USER_ID);
//get the exchange rate from the gocoin web service
$exchange = GoCoin::getExchangeRates();
//echo an HTML block
echo '<html><head><title>GoCoin User Test</title></head><body>' . "\n";
//get the current version
echo '<h3 style="color:blue">Library Version</h3>';
$version = GoCoin::getVersion();
echo '<ul><li>' . $version . '</li></ul>';
//show the current exchange
echo '<h3 style="color:blue">Current Exchange</h3>';
showObject($exchange);
//show the current user
echo '<hr/>' . "\n";
echo '<h3 style="color:blue">Current User</h3>';
showObject($user);
//show the specific user
echo '<hr/>' . "\n";
echo '<h3 style="color:blue">Specific User</h3>';
showObject($specific);
//update user tests
$UPDATE = FALSE;
if ($UPDATE) {