public function testGetAggregatorsNamesProvidesArrayWithAllSourceNames()
 {
     $names = $this->subjectUnderTest->getAggregatorsNames();
     $this->assertInternalType('array', $names);
     $this->assertCount(2, $names);
     $this->assertContains('OpenSourceTracker', $names);
     $this->assertContains('AnotherOSTracker', $names);
 }
Example #2
0
 private function initializeSources()
 {
     $this->logger->debug('Initialization of sources started');
     $this->sources = [];
     $sources = $this->configurationProvider->getAggregatorsNames();
     $this->logger->debug('Found ' . count($sources) . ' aggregator(s)');
     foreach ($sources as $sourceName) {
         $this->logger->debug("Initializing {$sourceName} aggregator");
         //TODO ConfigurationProvider should be passed to aggregator and than aggregator should configure itself
         $config = $this->configurationProvider->getAggregatorConfiguration($sourceName);
         if ($config === false) {
             throw new ConfigurationException('Failed to configure ' . $sourceName . ' aggregator. Did you defined type for it?');
         }
         $sourceClass = $this->configurationProvider->getAggregatorClassNameByAggregatorName($sourceName);
         if ($sourceClass === false) {
             throw new \RuntimeException("Failed to locate object for {$sourceName} aggregator! (THIS IS A BUG)");
         }
         $this->sources[] = new $sourceClass($this->appConfiguration, $config, $this->logger);
         $this->logger->debug("{$sourceName} aggregator initialized");
     }
     $this->logger->debug('All aggregators ready');
 }