/** @test */ public function it_can_parse_a_certificate() { $monitor = new SSLCertificateMonitor(['url' => 'https://www.example.com/']); $monitor->processCertificate($this->certificate); $this->assertEquals('www.example.com', $monitor->getCertificateDomain()); $this->assertEquals('2016-05-19', $monitor->getCertificateExpiration()); }
/** @test */ public function it_can_handle_a_missing_certificate() { $sslCertificateMonitor = new SSLCertificateMonitor(['url' => 'https://www.implode.com/']); $sslCertificateMonitor->runMonitor(); $this->assertNotEquals('www.implode.com', $sslCertificateMonitor->getCertificateDomain()); }
/** * @param SSLCertificateMonitor $sslCertificateMonitor */ public function sslCertificateInvalid(SSLCertificateMonitor $sslCertificateMonitor) { $this->sendNotification('whenSSLCertificateInvalid', "SSL Certificate Invalid: {$sslCertificateMonitor->getUrl()}", "SSL Certificate is invalid for {$sslCertificateMonitor->getUrl()}. Certificate domain is {$sslCertificateMonitor->getCertificateDomain()}. Certificate expiration date is {$sslCertificateMonitor->getCertificateExpiration()} ({$sslCertificateMonitor->getCertificateDaysUntilExpiration()} days).", BaseSender::TYPE_ERROR); }