1
0
Fork 0

Cache executable finder calls

pull/5990/head
Jordi Boggiano 2016-12-23 15:01:05 +01:00 committed by GitHub
parent ab70601700
commit df5fd3ba09
1 changed files with 7 additions and 2 deletions

View File

@ -22,6 +22,7 @@ use Symfony\Component\Process\ExecutableFinder;
abstract class TestCase extends \PHPUnit_Framework_TestCase abstract class TestCase extends \PHPUnit_Framework_TestCase
{ {
private static $parser; private static $parser;
private static $executableCache = array();
public static function getUniqueTmpDirectory() public static function getUniqueTmpDirectory()
{ {
@ -94,9 +95,13 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
*/ */
protected function skipIfNotExecutable($executableName) protected function skipIfNotExecutable($executableName)
{ {
$finder = new ExecutableFinder(); if (!isset(self::$executableCache[$executableName])) {
$finder = new ExecutableFinder();
self::$executableCache[$executableName] = (bool) $finder->find($executableName);
}
if (!$finder->find($executableName)) if (false === self::$executableCache[$executableName]) {
$this->markTestSkipped($executableName . ' is not found or not executable.'); $this->markTestSkipped($executableName . ' is not found or not executable.');
}
} }
} }