protected static function setTestApiKey() { if (self::API_KEY == null) { BlockScore::setApiKey(getenv('BLOCKSCORE_API_KEY')); } else { BlockScore::setApiKey(self::API_KEY); } }
public function testCurlErrorHandling() { $endpoint = BlockScore::$apiEndpoint; BlockScore::$apiEndpoint = 'https://totally-legit-api-endpoint.blockscore.com'; try { self::createTestPerson(); // Always fail $this->assertTrue(false); } catch (Util\Exception $e) { $expected = 'curl_error'; $this->assertSame($expected, $e->type); $this->assertTrue($e instanceof Util\Exception); } BlockScore::$apiEndpoint = $endpoint; }