public function testUnauthorizedAccess() { try { $this->owm->getWeather('Paris'); } catch (OWMException $e) { $this->assertEquals(401, $e->getCode()); $this->assertRegExp('/^Invalid API key/', $e->getMessage()); } }