/** * Triggers downloading new data from origin and parsing it. * Normally this method is executed by ping(), but you may decide to call it manually at any time. */ public function getNewDataFromOrigin() { //TODO maybe add checksum to skip all operations if it's the same as previous? $feed = $this->fetchFeed($this->configuration->getUrl()); if ($feed === false) { $this->logger->error($this->getName() . ': Failed to fetch feed from ' . $this->configuration->getUrl()); return; } $this->logger->debug('Downloaded RSS for ' . $this->configuration->getUrl() . ' (' . strlen($feed) . ' bytes)'); $this->lastSuccessfulDownload = time(); $feed = $this->parseFeedXml($feed); if ($feed === false) { return; } $this->blacklist->applyBlacklist($feed); if (empty($feed)) { $this->logger->debug($this->getName() . ': No new links in feed'); return; } foreach ($feed as $name => $link) { $this->links[] = ['name' => $name, 'link' => $link]; } }
/** * @dataProvider validUrlsProvider */ public function testUrlAcceptsValidValues($url) { $this->subjectUnderTest->setUrl($url); $this->assertSame($url, $this->subjectUnderTest->getUrl()); }