]> git.mxchange.org Git - core.git/blobdiff - framework/loader/class_ClassLoader.php
Continued:
[core.git] / framework / loader / class_ClassLoader.php
index b31d21fbc455ab8531cf530f3261070eaaca2742..07dfd8420b77bfbbd01441bb9bac0ffb3f40ddec 100644 (file)
@@ -342,17 +342,31 @@ final class ClassLoader {
         *
         * @param       $relativePath   Relative path to test classes
         * @return      void
-        * @throws      InvalidArgumentException        If a parameter is invalid
+        * @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 = FrameworkBootstrap::getConfigurationInstance()->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]: relativePath=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $relativePath);
+               //* NOISY-DEBUG: */ printf('[%s:%d]: Adding relativePath=%s ...' . PHP_EOL, __METHOD__, __LINE__, $relativePath);
                self::$testPaths[$relativePath] = $relativePath;
 
                // Trace message