X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=Civi%2FCiUtil%2FPHPUnitScanner.php;h=a1028f52f5c8986f3f5088284e1d8cb9ba3f54f4;hb=f73476b3fda62c096a121b7bfbaf0045a2fd13bf;hp=b09de45367b615124d178aa623584a9ef3cbd925;hpb=27ccf2971fbceea387c5ad9e120636cef2e87696;p=civicrm-core.git diff --git a/Civi/CiUtil/PHPUnitScanner.php b/Civi/CiUtil/PHPUnitScanner.php index b09de45367..a1028f52f5 100644 --- a/Civi/CiUtil/PHPUnitScanner.php +++ b/Civi/CiUtil/PHPUnitScanner.php @@ -1,20 +1,22 @@ class names + * @param $path + * @return array class names */ - static function _findTestClasses($path) { -// print_r(array( -// 'loading' => $path, -// get_included_files() -// )); - + public static function _findTestClasses($path) { + // print_r(array( + // 'loading' => $path, + // get_included_files() + // )); $origClasses = get_declared_classes(); require_once $path; $newClasses = get_declared_classes(); @@ -26,10 +28,12 @@ class PHPUnitScanner { } /** + * @param $paths * @return array (string $file => string $class) + * @throws \Exception */ - static function findTestClasses($paths) { - $testClasses = array(); + public static function findTestClasses($paths) { + $testClasses = []; $finder = new Finder(); foreach ($paths as $path) { @@ -65,27 +69,30 @@ class PHPUnitScanner { } /** - * @param array $testClasses - * @return array each element is an array with keys: + * @param array $paths + * + * @return array + * each element is an array with keys: * - file: string * - class: string * - method: string */ - static function findTestsByPath($paths) { - $r = array(); + public static function findTestsByPath($paths) { + $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; } -} \ No newline at end of file + +}