/** * 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. * 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. * * @param \Mutagenesis\Runner\RunnerAbstract $baseRunner * @param bool $useStdout * @param bool $firstRun * @param array $mutation * @param array $testCases * @return array */ public function runTests(\Mutagenesis\Runner\Base $runner, $useStdout = true, $firstRun = false, array $mutation = array(), array $testCases = array()) { $options = $runner->getOptions(); $job = new \Mutagenesis\Utility\Job(); if (!$useStdout) { array_unshift($options['clioptions'], '--stderr'); } if (!in_array('--stop-on-failure', $options['clioptions'])) { array_unshift($options['clioptions'], '--stop-on-failure'); } array_unshift($options['clioptions'], 'phpunit'); if ($firstRun) { $options['clioptions'] = array_merge($options['clioptions'], array('--log-junit', $options['cache'] . '/mutagenesis.xml'), explode(' ', $options['constraint'])); } if (count($testCases) > 0) { // tests cases always 0 on first run foreach ($testCases as $case) { $args = $options; $args['clioptions'][] = $case['class']; $args['clioptions'][] = $case['file']; $output = self::execute($job->generate($mutation, $args, $runner->getTimeout(), $runner->getBootstrap())); if (!$this->processOutput($output['stdout'])) { return array(false, $output); } } } else { $output = self::execute($job->generate($mutation, $options, 0, $runner->getBootstrap())); if (!$this->processOutput($output['stdout'])) { return array(false, $output); } } return array(true, $output); }
public function testShouldStoreSourceExcludeValue() { $runner = new \Mutagenesis\Runner\Base(); $runner->setSourceExcludes($exc = array("123.php", "456.php")); $this->assertEquals($exc, $runner->getSourceExcludes()); }
public function testShouldStoreCliOptions() { $runner = new Base(); $runner->setAdapterOption('foo')->setAdapterOption('bar'); $this->assertEquals(array('foo', 'bar'), $runner->getAdapterOptions()); }