//* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
}
- /**
- * Scans for test classes, etc.
- *
- * @return void
- * @throws UnexpectedValueException If a given path isn't one or not readable
- */
- public static function scanTestsClasses () {
- // Get loader instance
- //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
- $loaderInstance = self::getSelfInstance();
-
- // "Cache" root base path
- $basePath = self::$configInstance->getConfigEntry('root_base_path');
-
- // Load all classes for the application
- //* NOISY-DEBUG: */ printf('[%s:%d]: self::testPaths()=%d,basePath=%s' . PHP_EOL, __METHOD__, __LINE__, count(self::$testPaths), $basePath);
- foreach (self::$testPaths as $shortPath) {
- // Construct path name
- //* NOISY-DEBUG: */ printf('[%s:%d]: shortPath=%s' . PHP_EOL, __METHOD__, __LINE__, $shortPath);
- $realPathName = realpath(sprintf(
- '%s%s%s',
- $basePath,
- DIRECTORY_SEPARATOR,
- $shortPath
- ));
-
- // Is the path readable?
- //* NOISY-DEBUG: */ printf('[%s:%d]: realPathName[%s]=%s - AFTER!' . PHP_EOL, __METHOD__, __LINE__, gettype($realPathName), $realPathName);
- if (!is_string($realPathName)) {
- // Skip this cone
- //* NOISY-DEBUG: */ printf('[%s:%d]: realPathName[]=%s - SKIPPED!' . PHP_EOL, __METHOD__, __LINE__, gettype($realPathName));
- continue;
- } elseif (!is_dir($realPathName)) {
- // Is not a directory
- throw new UnexpectedValueException(sprintf('realPathName=%s is not a directory', $realPathName), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE);
- } elseif (!is_readable($realPathName)) {
- // Not readable
- throw new UnexpectedValueException(sprintf('realPathName=%s cannot be read from', $realPathName), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE);
- }
-
- // Try to load the application classes
- //* NOISY-DEBUG: */ printf('[%s:%d]: Scanning for classes/interfaces at realPathName=%s ...' . PHP_EOL, __METHOD__, __LINE__, $realPathName);
- $loaderInstance->scanClassPath($realPathName);
- }
-
- // Trace message
- //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
- }
-
/**
* Enables or disables strict naming-convention tests on class loading
*
self::$strictNamingConvention = $strictNamingConvention;
}
- /**
- * Registeres given relative path where test classes reside. For regular
- * framework uses, they should not be loaded (and used).
- *
- * @param $relativePath Relative path to test classes
- * @return void
- * @throws InvalidArgumentException If a parameter is invalid or path not found
- */
- public static function registerTestsPath (string $relativePath) {
- // Validate parameter
- //* NOISY-DEBUG: */ printf('[%s:%d]: relativePath=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $relativePath);
- if (empty($relativePath)) {
- // Should not be empty
- throw new InvalidArgumentException('Parameter "relativePath" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
- }
-
- // Get real path from it
- $fullQualifiedPath = self::$configInstance->getConfigEntry('root_base_path') . $relativePath;
-
- // Is it there?
- //* NOISY-DEBUG: */ printf('[%s:%d]: fullQualifiedPath=%s' . PHP_EOL, __METHOD__, __LINE__, $fullQualifiedPath);
- if (!is_dir($fullQualifiedPath)) {
- // Not there
- throw new InvalidArgumentException(sprintf('fullQualifiedPath=%s cannot be found', $fullQualifiedPath));
- } elseif (!is_readable($fullQualifiedPath)) {
- // Not readable
- throw new InvalidArgumentException(sprintf('fullQualifiedPath=%s is not readable', $fullQualifiedPath));
- }
-
- // "Register" it
- //* NOISY-DEBUG: */ printf('[%s:%d]: Adding relativePath=%s ...' . PHP_EOL, __METHOD__, __LINE__, $relativePath);
- self::$testPaths[$relativePath] = $relativePath;
-
- // Trace message
- //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
- }
-
/**
* Autoload-function
*