Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoload test directories #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

opdavies
Copy link

Problem

I've been evaluating Phpactor recently whilst working on Drupal projects and found that I was getting a There are no class name candidates error when trying to create a new class.

After installing this plugin and dumping an updated autoloader, creating a class within a module's src directory worked, but it still couldn't generate a test class within the tests/src directory.

Solution

Reviewing the autoload_psr4.php file, I could see that the module's src directory was being loaded correctly but the tests/src directory wasn't included.

After adding one manually to confirm it fixed the issue, I've created this PR that checks for a tests/src directory within each module and if one exists, adds it to the expected Drupal\\Tests\\ namespace`.

If a module contains a `tests/src` directory, autoload this too within
the `Drupal\\Tests` namespace.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant