Mutagenesis\Console::main PHP Метод

main() публичный статический Метод

Sets up options, and initialises the Runner to perform mutation tests and echo out the results
public static main ( array $options = null, RunnerAbstract $runner = null )
$options array
$runner Mutagenesis\Runner\RunnerAbstract Optional custom runner
    public static function main(array $options = null, \Mutagenesis\Runner\RunnerAbstract $runner = null)
    {
        if (is_null($options)) {
            self::$_options = getopt('', array('base::', 'src::', 'tests::', 'adapter::', 'bootstrap::', 'options::', 'timeout::', 'detail-captures::', 'constraint::'));
        } else {
            self::$_options = $options;
        }
        if (is_null($runner)) {
            $runner = new \Mutagenesis\Runner\Base();
        }
        self::setBaseDirectory($runner);
        self::setSourceDirectory($runner);
        self::setTestDirectory($runner);
        self::setAdapterName($runner);
        self::setBootstrap($runner);
        self::setAdapterOptions($runner);
        self::setTimeout($runner);
        self::setDetailCaptures($runner);
        self::setAdapterConstraint($runner);
        $result = $runner->execute();
        echo $result;
    }

Usage Example

Пример #1
0
 public function testConsoleExecutesRunnerAndEchosOutput()
 {
     $runner = $this->getMock('Mutagenesis\\Runner\\Base', array('execute'));
     $runner->expects($this->once())->method('execute')->will($this->returnValue('mutation results'));
     ob_start();
     \Mutagenesis\Console::main(null, $runner);
     $this->assertEquals(ob_get_clean(), 'mutation results');
 }