public function testExchange() { if (!$this->doTest(__FUNCTION__)) { return; } //get the exchange rate from the gocoin web service $exchange = GoCoin::getExchangeRates(); //perform assertion $this->assertTrue(property_exists($exchange, 'prices')); $this->assertTrue(property_exists($exchange->prices, 'BTC')); echo '[DEBUG]: SUCCESS:' . $exchange->prices->BTC->USD . "\n"; }
ini_set('display_errors', 1); //include the config and the gocoin api require_once __DIR__ . '/includes/config.php'; require_once __DIR__ . '/includes/functions.php'; 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";