/** * @param HttpPingMonitor $httpPingMonitor */ public function httpPingDown(HttpPingMonitor $httpPingMonitor) { $additionalInfo = ''; if ($httpPingMonitor->getCheckPhrase() && !$httpPingMonitor->getResponseContainsPhrase()) { $additionalInfo = " Response did not contain \"{$httpPingMonitor->getCheckPhrase()}\""; } $this->sendNotification('whenHttpPingDown', "HTTP Ping Failed: {$httpPingMonitor->getUrl()}!", "HTTP Ping Failed for {$httpPingMonitor->getUrl()}! Response Code {$httpPingMonitor->getResponseCode()}.{$additionalInfo}", BaseSender::TYPE_ERROR); }
/** @test */ public function it_can_find_text_in_a_response() { $httpPingMonitor = new HttpPingMonitor(['url' => 'http://www.example.com/', 'checkPhrase' => 'Example Domain']); $httpPingMonitor->runMonitor(); $this->assertTrue($httpPingMonitor->getResponseContainsPhrase()); }