Hal\MutaTesting\Runner\Adapter\AtoumAdapter::getSuiteResult PHP Method

getSuiteResult() public method

Get results of unit test suites by the file where the junit result is logged
public getSuiteResult ( string $logPath ) : Hal\MutaTesting\Test\UnitCollectionInterface
$logPath string
return Hal\MutaTesting\Test\UnitCollectionInterface
    public function getSuiteResult($logPath)
    {
        $factory = new XUnitFactory();
        $results = $factory->factory(file_get_contents($logPath));
        return $results;
    }

Usage Example

 public function testICanGetTestSuitesWithMultipleTests()
 {
     // tests
     $filename = $this->directory . 'ExampleTest1.php';
     $content = '<?php
         namespace vendor\\project\\tests\\units;
         require_once "ExampleSrc1.php";
         use \\mageekguy\\atoum;
         use \\vendor\\project;
         class helloWorld1 extends atoum\\test {
             public function testSay() {
                 $this->string("1")->isEqualTo("2")
                 ;
             }
         }
     ';
     file_put_contents($filename, $content);
     $filename = $this->directory . 'ExampleTest2.php';
     $content = '<?php
         namespace vendor\\project\\tests\\units;
         require_once "ExampleSrc2.php";
         use \\mageekguy\\atoum;
         use \\vendor\\project;
         class helloWorld2 extends atoum\\test {
             public function testSay() {
                 $this->string("1")->isEqualTo("1")
                 ;
             }
         }
     ';
     file_put_contents($filename, $content);
     // sources
     $filename = $this->directory . 'ExampleSrc1.php';
     $content = '<?php
     namespace vendor\\project;
     class helloWorld1 {
         public function say() {
             return "Hello World!";
         }
         public function foo() {
             return "Hello foo";
         }
     }
     ';
     file_put_contents($filename, $content);
     $filename = $this->directory . 'ExampleSrc2.php';
     $content = '<?php
     namespace vendor\\project;
     class helloWorld2 {
         public function say() {
             return "Hello World!";
         }
         public function foo() {
             return "Hello foo";
         }
     }
     ';
     file_put_contents($filename, $content);
     $runner = new AtoumAdapter($this->binary, $this->directory);
     $logFile = tempnam(sys_get_temp_dir(), 'unit-test');
     $runner->run(null, array(), $logFile);
     $collection = $runner->getSuiteResult($logFile);
     $this->assertInstanceOf('\\Hal\\MutaTesting\\Test\\UnitCollectionInterface', $collection);
     $this->assertEquals(2, sizeof($collection->all()));
     $unit = $collection->getByFile($this->directory . 'ExampleTest1.php');
     $this->assertInstanceOf('\\Hal\\MutaTesting\\Test\\UnitInterface', $unit);
 }