First commit
This commit is contained in:
commit
c6e2478c40
13918 changed files with 2303184 additions and 0 deletions
37
sites/all/modules/civicrm/Civi/CiUtil/EnvTestRunner.php
Normal file
37
sites/all/modules/civicrm/Civi/CiUtil/EnvTestRunner.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
namespace Civi\CiUtil;
|
||||
|
||||
/**
|
||||
* Parse phpunit result files
|
||||
*/
|
||||
class EnvTestRunner {
|
||||
protected $phpunit;
|
||||
protected $envTestSuite;
|
||||
|
||||
/**
|
||||
* @param string $phpunit
|
||||
* @param string $envTestSuite
|
||||
*/
|
||||
public function __construct($phpunit = "phpunit", $envTestSuite = 'EnvTests') {
|
||||
$this->phpunit = $phpunit;
|
||||
$this->envTestSuite = $envTestSuite;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $tests
|
||||
* @return array
|
||||
* (string $testName => string $status)
|
||||
*/
|
||||
public function run($tests) {
|
||||
$envTests = implode(' ', $tests);
|
||||
$jsonFile = tempnam(sys_get_temp_dir(), 'phpunit-json-');
|
||||
unlink($jsonFile);
|
||||
$command = "env PHPUNIT_TESTS=\"$envTests\" {$this->phpunit} --log-json $jsonFile {$this->envTestSuite}";
|
||||
echo "Running [$command]\n";
|
||||
system($command);
|
||||
$results = PHPUnitParser::parseJsonResults(file_get_contents($jsonFile));
|
||||
unlink($jsonFile);
|
||||
return $results;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue