Companion to GitLab issue #3540378 (reported by alex.skrypnyk).
Problem
Running vendor/bin/rector --clear-cache --dry-run on a project that has a contrib module with a case-mismatched test namespace aborts the entire run:
Error: [ERROR] RecursiveDirectoryIterator::__construct(/app/web/modules/contrib/webform/modules/webform_cards/tests/src/FunctionalJavaScript): Failed to open directory: No such file or directory
Root cause: config/drupal-phpunit-bootstrap-file.php iterates test directories derived from namespaces. webform_cards declares Drupal\Tests\webform_cards\FunctionalJavascript (lowercase "s") while the directory is FunctionalJavaScript (uppercase "S"), so the iterator points at a non-existent path and throws. One bad contrib module takes down the whole rector run.
Proposed fix
In config/drupal-phpunit-bootstrap-file.php, guard the directory iteration with an is_dir() check (or wrap in try/catch) and skip + emit a clear warning for the offending path instead of fataling. The actual namespace bug is the contrib module's to fix (see webform #3441905), but drupal-rector shouldn't hard-fail the entire run because of it.
Related: #3441905.
Companion to GitLab issue #3540378 (reported by alex.skrypnyk).
Problem
Running
vendor/bin/rector --clear-cache --dry-runon a project that has a contrib module with a case-mismatched test namespace aborts the entire run:Root cause:
config/drupal-phpunit-bootstrap-file.phpiterates test directories derived from namespaces. webform_cards declaresDrupal\Tests\webform_cards\FunctionalJavascript(lowercase "s") while the directory isFunctionalJavaScript(uppercase "S"), so the iterator points at a non-existent path and throws. One bad contrib module takes down the whole rector run.Proposed fix
In
config/drupal-phpunit-bootstrap-file.php, guard the directory iteration with anis_dir()check (or wrap in try/catch) and skip + emit a clear warning for the offending path instead of fataling. The actual namespace bug is the contrib module's to fix (see webform #3441905), but drupal-rector shouldn't hard-fail the entire run because of it.Related: #3441905.