public function testSendRequestError() { if (!$this->CONNECTION_IS_SET) { $this->markTestIncomplete("Please define environment var INSIGHT_CONNECTION_STRING to run this test."); return; } // expects exception $exception_caught = false; $insight_client = new Client($this->CONNECTION_STRING); try { $response_data = $insight_client->getTransaction('badbadtxid'); } catch (Exception $e) { $exception_caught = true; } PHPUnit::assertTrue($exception_caught); PHPUnit::assertEquals(400, $e->getCode()); }