X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=Civi%2FCiUtil%2FPHPUnitScanner.php;h=a1028f52f5c8986f3f5088284e1d8cb9ba3f54f4;hb=2918a67d3bde046b49ef6073e97de1132cca9bac;hp=61534bf5357c45f2f5132e0e9ddc69b87733470c;hpb=257e766661dd8d801835a792082b14d80926107e;p=civicrm-core.git diff --git a/Civi/CiUtil/PHPUnitScanner.php b/Civi/CiUtil/PHPUnitScanner.php index 61534bf535..a1028f52f5 100644 --- a/Civi/CiUtil/PHPUnitScanner.php +++ b/Civi/CiUtil/PHPUnitScanner.php @@ -7,16 +7,16 @@ use Symfony\Component\Finder\Finder; * Search for PHPUnit test cases */ class PHPUnitScanner { + /** * @param $path * @return array class names */ public static function _findTestClasses($path) { -// print_r(array( -// 'loading' => $path, -// get_included_files() -// )); - + // print_r(array( + // 'loading' => $path, + // get_included_files() + // )); $origClasses = get_declared_classes(); require_once $path; $newClasses = get_declared_classes(); @@ -30,11 +30,10 @@ class PHPUnitScanner { /** * @param $paths * @return array (string $file => string $class) - * (string $file => string $class) * @throws \Exception */ public static function findTestClasses($paths) { - $testClasses = array(); + $testClasses = []; $finder = new Finder(); foreach ($paths as $path) { @@ -79,20 +78,21 @@ class PHPUnitScanner { * - method: string */ public static function findTestsByPath($paths) { - $r = array(); + $r = []; $testClasses = self::findTestClasses($paths); foreach ($testClasses as $testFile => $testClass) { $clazz = new \ReflectionClass($testClass); foreach ($clazz->getMethods() as $method) { if (preg_match('/^test/', $method->name)) { - $r[] = array( + $r[] = [ 'file' => $testFile, 'class' => $testClass, - 'method' => $method->name - ); + 'method' => $method->name, + ]; } } } return $r; } + }