/** * @test */ public function addingSectionsIsPossible() { $environment = PHP_ConfigReport_Analyzer::PRODUCTION; $report = new PHP_ConfigReport_Report($environment, PHP_VERSION); $section1 = new PHP_ConfigReport_Report_Section('Test1'); $report->addSection($section1); $this->assertSame(array($section1), $report->getSections()); $section2 = new PHP_ConfigReport_Report_Section('Test2'); $report->addSection($section2); $this->assertSame(array($section1, $section2), $report->getSections()); }
/** * Generates and returns report * * @return PHP_ConfigReport_Report Report */ public function getReport() { $report = new PHP_ConfigReport_Report($this->_environment, $this->_phpVersion); $extensions = array(); $path = dirname(__FILE__) . '/Analyzer'; $iterator = new DirectoryIterator($path); foreach ($iterator as $item) { if ($item->isFile() && !$item->isDot() && 'Abstract.php' != substr($item->getFilename(), -12)) { $extensions[] = substr($item->getFilename(), 0, -4); } } sort($extensions); foreach ($extensions as $extension) { $class = "PHP_ConfigReport_Analyzer_{$extension}"; $instance = new $class($this->_config, $this->_environment, $this->_phpVersion, $this->_loadedExtensions); $report->addSection($instance->getReportSection()); } return $report; }