/** * @desc tests bad response * @expectedException Exception * @expectedExceptionMessageRegExp /Unable to contact Transmissions API:.* / */ public function testFindForCatchAllException() { $mock = new MockPlugin(); $mock->addResponse(new Response(500)); $this->client->addSubscriber($mock); Transmission::find('someId'); }
<?php namespace Examples\Transmisson; require_once dirname(__FILE__) . '/../bootstrap.php'; use SparkPost\SparkPost; use SparkPost\Transmission; $key = 'YOURAPIKEY'; SparkPost::setConfig(array('key' => $key)); try { $results = Transmission::find('Your Transmission Id'); echo 'Congrats you can use your SDK!'; } catch (\Exception $exception) { echo $exception->getMessage(); }