public function testReponse() { // example for mock Responses $client = OmDataClient::factory(array('api_key' => '****')); $plugin = new MockPlugin(); $plugin->addResponse(new Response(200, null, 'This is the body content')); $client->addSubscriber($plugin); $command = $client->getCommand('serps_weekly/get_rankings', array('keyword' => 'hausbau', 'date' => '2013-11-24')); $result = $command->execute(); //var_dump($result->getBody(true)); }
public function setUp() { $config = array('api_key' => $_SERVER['API_KEY']); $this->client = OmDataClient::factory($config); }
<?php require_once 'configForExamples.php'; require_once '../vendor/autoload.php'; use Zedwoo\OnlineMarketingApiToolkit\OmData\OmDataClient; $client = OmDataClient::factory(array('api_key' => ZEDWOO_API_KEY)); $command = $client->getCommand('account/status'); $result = $command->execute(); var_dump($result);
<?php require_once 'configForExamples.php'; require_once '../vendor/autoload.php'; use Zedwoo\OnlineMarketingApiToolkit\OmData\OmDataClient; $client = OmDataClient::factory(array('api_key' => 'nonsense')); try { $command = $client->getCommand('account/status'); $result = $command->execute(); var_dump($result); } catch (Guzzle\Http\Exception\BadResponseException $e) { echo 'Uh oh! ' . $e->getMessage(); }
/** * @expectedException \Guzzle\Common\Exception\InvalidArgumentException */ public function testFactoryReturnsExceptionOnBlankArguments() { $config = array('api_key' => ''); $client = OmDataClient::factory($config); }