PHP Class Mutagenesis\Adapter\Phpunit

Inheritance: extends AdapterAbstract
显示文件 Open project: padraic/mutagenesis Class Usage Examples

Public Methods

Method Description
execute ( string $jobScript ) : string Execute the generated job which is to call the static main method.
main ( array $arguments, $mutation = null, $bootstrap = null ) : void Uses an instance of PHPUnit_TextUI_Command to execute the PHPUnit tests and simulates any Mutagenesis supported command line options suitable for PHPUnit. At present, we merely dissect a generic 'options' string equivelant to anything typed into a console after a normal 'phpunit' command. The adapter captures the TextUI output for further processing.
processOutput ( string $output ) : boolean Parse the PHPUnit text result output to see if there were any failures.
runTests ( Base $runner, boolean $useStdout = true, boolean $firstRun = false, array $mutation = [], array $testCases = [] ) : array Runs the tests suite according to Runner set options and the execution order of test case (if any). It then returns an array of two elements.

Method Details

execute() public static method

Execute the generated job which is to call the static main method.
public static execute ( string $jobScript ) : string
$jobScript string
return string $output

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

processOutput() public static method

In the context of mutation testing, a test failure is good (i.e. the mutation was detected by the test suite).
public static processOutput ( string $output ) : boolean
$output string
return boolean

runTests() public method

First element is a boolean result value indicating if tests passed or not. Second element is an array containing the key "stdout" which stores the output from the last test run.
public runTests ( Base $runner, boolean $useStdout = true, boolean $firstRun = false, array $mutation = [], array $testCases = [] ) : array
$runner Mutagenesis\Runner\Base
$useStdout boolean
$firstRun boolean
$mutation array
$testCases array
return array