/** * @param MonitorModel $monitor * @return Model */ public function all(MonitorModel $monitor) { $arr = []; $history = json_decode($this->get('history/' . $monitor->getMonitorUid()), true); foreach ($history as $h) { array_push($arr, $this->deserialize(json_encode($h), Model::class)); } return new Collection($arr); }
/** * Remove monitor * @param Model $monitor * @return Monitor */ public function remove(Model $monitor) : Monitor { $this->delete('monitor/{' . $monitor->getMonitorUid() . '}'); return $this; }
public function testCanSetInfo() { // Arrange $response = new Monitor(); // Act $response->setMonitorUid('test info'); $response->setActionString('test info'); $response->setLastTransition('2016-01-18T04:46:02.0961705-06:00'); $response->setLastChecked('2016-01-18T04:46:02.0961705-06:00'); $response->setMxRep('test info'); $response->setHistoryUrl('test info'); $response->setName('test info'); $response->setTimeElapsed('test info'); $response->setRecordCount(123); $response->setLarUid('test info'); $response->setFrequencyInMinutes(123); $response->setCurrentStatus(123); $response->setExpiresIn('test info'); $response->setExpirationInHours(123); $response->setIsActive(true); $response->setDomainSubscription('test info'); $response->setTags(['key' => 'test info']); $response->setFailing(['key' => 'test info']); $response->setWarnings(['key' => 'test info']); $response->setStatusSummary('test info'); // Assert $this->assertEquals('test info', $response->getMonitorUid()); $this->assertEquals('test info', $response->getActionString()); $this->assertInstanceOf(\DateTime::class, $response->getLastTransition()); $this->assertInstanceOf(\DateTime::class, $response->getLastChecked()); $this->assertEquals('test info', $response->getMxRep()); $this->assertEquals('test info', $response->getHistoryUrl()); $this->assertEquals('test info', $response->getName()); $this->assertEquals('test info', $response->getTimeElapsed()); $this->assertEquals(123, $response->getRecordCount()); $this->assertEquals('test info', $response->getLarUid()); $this->assertEquals(123, $response->getFrequencyInMinutes()); $this->assertEquals(123, $response->getCurrentStatus()); $this->assertEquals('test info', $response->getExpiresIn()); $this->assertEquals(123, $response->getExpirationInHours()); $this->assertEquals(true, $response->getIsActive()); $this->assertEquals('test info', $response->getDomainSubscription()); $this->assertEquals('test info', $response->getTags()['key']); $this->assertEquals('test info', $response->getFailing()['key']); $this->assertEquals('test info', $response->getWarnings()['key']); $this->assertEquals('test info', $response->getStatusSummary()); }