/**
* Get results of unit test suites by the file where the junit result is logged
*
* @param string $logPath
* @return UnitCollectionInterface
*/
public function getSuiteResult($logPath)
{
$factory = new JUnitFactory();
if (!file_exists($logPath)) {
throw new \Hal\MutaTesting\Test\Exception\TestSuiteNotFoundException(sprintf('results not found. Last command : "%s"', $this->getLastCommand()));
}
$content = file_get_contents($logPath);
if (0 === strlen($content)) {
throw new \Hal\MutaTesting\Test\Exception\TestSuiteNotFoundException(sprintf('results are empty. Last command : "%s"', $this->getLastCommand()));
}
try {
$results = $factory->factory($content);
} catch (\UnexpectedValueException $e) {
throw new \LogicException(sprintf("Cannot get any informations about tests. There is probably no test with your configuration. \n[Executed command : %s]", $this->getLastCommand()));
}
return $results;
}