// Load the actual autoloader being used and determine its filename using
// reflection. We can determine the vendor directory based on that filename.
$autoloader =
require $this->appRoot . '/autoload.php';
$reflector =
new \
ReflectionClass($autoloader);
$vendor_dir =
dirname($reflector->
getFileName(), 2
);
// The file in Composer's bin dir is a *nix link, which does not work when
// extracted from a tarball and generally not on Windows.
$command =
$vendor_dir . '/phpunit/phpunit/phpunit';
if (substr(PHP_OS, 0, 3
) == 'WIN'
) { // On Windows it is necessary to run the script using the PHP executable.
$php_executable_finder =
new PhpExecutableFinder();
$php =
$php_executable_finder->
find();
$command =
$php . ' -f ' .
escapeshellarg($command) . ' --';
} return $command;
} /**
* Executes the PHPUnit command.
*
* @param string[] $unescaped_test_classnames
* An array of test class names, including full namespaces, to be passed as
* a regular expression to PHPUnit's --filter option.
* @param string $phpunit_file
* A filepath to use for PHPUnit's --log-junit option.
* @param int $status
* (optional) The exit status code of the PHPUnit process will be assigned
* to this variable.
* @param string[] $output
* (optional) The output by running the phpunit command. If provided, this
* array will contain the lines output by the command.
*
* @return string
* The results as returned by exec().
*
* @internal
*/