/** * @param $json * @return \Psr\Http\Message\ResponseInterface */ public function customers($json) { $customer = $this->customer->makeFromArray($json); $customers = Customers::make([$this->makeRobinCustomer($customer)]); try { return $this->robin->customers($customers); } catch (RobinSendFailedException $exception) { $this->error($customers, $exception, $customer); return new Response("", 500); } }
/** * @expectedException \Robin\Api\Exceptions\RobinSendFailedException */ public function testThrowsExceptionWhenRequestFails() { $api = $this->getRealRobinClient(); $api->customers(Customers::make(['this' => "should", 'trigger' => 'an', 'error'])); }