/** * Test request notify create. */ public function testNotifyCreate() { self::assertEquals($this->serviceKey, $this->pagerDutyNType->getServiceKey()); $incident = $this->createIncidentMock(); $incident->expects(self::any())->method('getStatus')->willReturn(IncidentInterface::STATUS_OK + 1); $incidentOk = $this->createIncidentMock(); $incidentOk->expects(self::any())->method('getStatus')->willReturn(IncidentInterface::STATUS_OK); $subject = $this->createSubject('target', '* * * * *'); $event = new Event(); $event->serviceKey = $this->serviceKey; $event->description = $incident->getIdent(); $event->incidentKey = 'hci_0'; $event->details = ['log' => $incident->getMessage(), 'status' => $incident->getStatus(), 'type' => $incident->getType(), 'id' => $incident->getId()]; $this->eventClientMock->expects(self::at(0))->method('post')->with($event); $event2 = clone $event; $event2->details = null; $event2->description = null; $event2->eventType = Event::EVENT_TYPE_RESOLVE; $this->eventClientMock->expects(self::at(1))->method('post')->with($event2); $this->pagerDutyNType->notify($subject, $incident); $this->pagerDutyNType->notify($subject, $incidentOk); }
/** * @expectedException \TonicForHealth\PagerDutyClient\Client\Exception\EventClientTransportException * @expectedExceptionMessage EventClient has a transport problem:Some http transport error */ public function testPostEventTransportException() { $event = $this->setUpStandardEvent(); $this->mockClient->addException(new HttpMethodsClientMockException("Some http transport error", 504)); $this->eventClient->post($event); }