Mutagenesis\Adapter\Phpunit::main PHP Method

main() public static method

To prevent duplication of output from stdout, PHPUnit is hard configured to write to stderrm(stdin is used in proc_open call)
public static main ( array $arguments, $mutation = null, $bootstrap = null ) : void
$arguments array Mutagenesis arguments to pass to PHPUnit
return void
    public static function main($arguments, $mutation = null, $bootstrap = null)
    {
        $arguments = unserialize($arguments);
        /**
         * Grab the Runkit extension utility and apply the mutation if needed
         */
        if (!is_null($mutation)) {
            $mutation = unserialize($mutation);
            if (!empty($mutation)) {
                if (!is_null($bootstrap)) {
                    require_once $bootstrap;
                }
                if (!in_array('runkit', get_loaded_extensions())) {
                    throw new \Exception('Runkit extension is not loaded. Unfortunately, runkit' . ' is essential for Mutagenesis. Please see the manual or' . ' README which explains how to install an updated runkit' . ' extension suitable for Mutagenesis and PHP 5.3.');
                }
                $runkit = new \Mutagenesis\Utility\Runkit();
                $runkit->applyMutation($mutation);
            }
        }
        /**
         * Switch working directory to tests and execute the test suite
         */
        $originalWorkingDirectory = getcwd();
        if (isset($arguments['tests'])) {
            chdir($arguments['tests']);
        }
        $command = new \PHPUnit_TextUI_Command();
        $command->run($arguments['clioptions'], false);
        chdir($originalWorkingDirectory);
    }