private function runTests($testFile, $state, $runName, $expectedResult, $group = null)
{
$phpunit = realpath(__DIR__ . '/../../../../../../../vendor/bin/phpunit');
$commandString = defined('PHP_BINARY') ? PHP_BINARY : 'php';
if (strpos($commandString, 'hhvm') === false) {
$commandString .= ' -d error_log=/tmp/dev.log';
}
$commandString .= ' ' . $phpunit . ' --configuration ' . __DIR__ . '/../phpunit-%s.xml' . ' --log-junit ' . __DIR__ . '/../result-' . $runName . '.xml' . ' --filter ' . $testFile;
if ($group) {
$commandString .= ' --group ' . $group;
}
$process = new Process(sprintf($commandString, $state));
$process->setWorkingDirectory(__DIR__ . '/../');
$process->run();
$this->assertTrue($expectedResult ? $process->isSuccessful() : !$process->isSuccessful(), $process->getOutput() . "\n\n\n" . $process->getErrorOutput());
}