/**
  * @test
  * @depends shouldCollectSourceFilesUnderRootDir
  */
 public function shouldCollectSourceFileTest2UnderRootDir(JsonFile $jsonFile)
 {
     $sourceFiles = $jsonFile->getSourceFiles();
     $name2 = 'test2.php';
     $path2 = $this->srcDir . DIRECTORY_SEPARATOR . $name2;
     $this->assertArrayHasKey($path2, $sourceFiles);
     $this->assertSourceFileTest2UnderRootDir($sourceFiles[$path2]);
 }
Esempio n. 2
0
protected function logCollectedSourceFiles(JsonFile $jsonFile)
{
$sourceFiles = $jsonFile->getSourceFiles();
$numFiles = count($sourceFiles);

$this->logger->info(sprintf('Found <info>%s</info> source file%s:', number_format($numFiles), $numFiles > 1 ? 's' : ''));

foreach ($sourceFiles as $sourceFile) {

$coverage = $sourceFile->reportLineCoverage();
$template = '  - ' . $this->colorizeCoverage($coverage, '%6.2f%%') . ' %s';

$this->logger->info(sprintf($template, $coverage, $sourceFile->getName()));
}

$coverage = $jsonFile->reportLineCoverage();
$template = 'Coverage: ' . $this->colorizeCoverage($coverage, '%6.2f%% (%d/%d)');
$metrics = $jsonFile->getMetrics();

$this->logger->info(sprintf($template, $coverage, $metrics->getCoveredStatements(), $metrics->getStatements()));
}