protected function setUp() { Postmaster::setApiKey(getenv('PM_API_KEY')); if (getenv('PM_API_HOST')) { Postmaster::$apiBase = getenv('PM_API_HOST'); } else { Postmaster::$apiBase = 'https://api.postmaster.io'; } }
function testUnexpectedNetworkError() { Postmaster::$apiBase = 'ssh://do-not-exist'; try { $result = Postmaster_AddressValidation::validate(array()); } catch (Network_Error $expected) { $msg = $expected->getMessage(); $this->assertStringStartsWith('Unexpected error', $msg); return; } $this->fail('An expected exception has not been raised.'); }