/** * @desc tests happy path */ public function testAllWithGoodResponse() { $mock = new MockPlugin(); $mock->addResponse(new Response(200, array(), '{"results":[{"test":"This is a test"}, {"test":"two"}]}')); $this->client->addSubscriber($mock); $this->assertEquals(array("results" => array(array('test' => 'This is a test'), array('test' => 'two'))), Transmission::all()); }
<?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::all(); echo 'Congrats you can use your SDK!'; } catch (\Exception $exception) { echo $exception->getMessage(); }