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

Error: Class PHPUnit\Framework\TestCase not found and could not be autoloaded #143

Closed
txemapamundi9l opened this issue Mar 2, 2020 · 2 comments

Comments

@txemapamundi9l
Copy link

Hello, I don't think this is a bug, but am hoping someone might be able to help me solve the problem, which other people might have.

I installed Drupal using Composer and drupal/recommended-project. When I run drupal-check on a module directory, I get the following error:
Class PHPUnit\Framework\TestCase not found and could not be autoloaded

How can you remove this error? It looks like PHPUnit is not included with drupal/recommended-project. The instructions at the following page just say to do 'composer install' or 'composer update', but I did that and still no PHPUnit:
https://www.drupal.org/docs/8/phpunit/running-phpunit-tests

@arderyp
Copy link

arderyp commented Apr 6, 2020

I get similar errors:

Class Drupal\Tests\UnitTestCase not found and could not be autoloaded.
Class Drupal\KernelTests\KernelTestBase not found and could not be autoloaded.
Class Drupal\Tests\BrowserTestBase not found and could not be autoloaded.
## and many more related to the module ##

Executing against some specific modules works fine, but executing against others doesn't (ctools and page_manager, to name two)

@ytsurk
Copy link

ytsurk commented Sep 23, 2021

drupal/core-dev to the resque 🗡️

See: https://drupal.stackexchange.com/a/293684

Basically when working on D8.9, use:

composer require --dev --with-all-dependencies 'drupal/core-dev:^8.9'

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

No branches or pull requests

4 participants