symfony / test-pack

A Symfony Pack for functional testing
MIT License
857 stars 9 forks source link

Class PHPUnit\Framework\TestCase not found and could not be autoloaded. #6

Closed koftikes closed 3 years ago

koftikes commented 5 years ago

When I use Symfony 4.1 and PhpStan 0.10 In case: Adding phpunit/phpunit as a dependency is discouraged in favor of Symfony's PHPUnit Bridge.

Instead: Remove it now: composer remove --dev phpunit/phpunit Use Symfony's bridge: composer require --dev phpunit i got next erors: Class PHPUnit\Framework\TestCase not found and could not be autoloaded. Class PHPUnit\Framework\TestCase was not found while trying to analyse it - autoloading is probably not configured properly. This hapens becouse phpunit not install before run a tests. you also can see next topic in PhpStan repo

carlospauluk commented 5 years ago

Same here. Weird!

dvdknaap commented 5 years ago

Got the same error. Haven't found any solution yet.

shehi commented 5 years ago

This shit is still happening. Any fixes?!

rafrsr commented 5 years ago

I have the same problem, I need install phpunit manually and ignore the warning otherwise phpunit does not install.

ribeiropaulor commented 5 years ago

The same here.

agent44 commented 5 years ago

If you run php bin/phpunit all the PHPUnit classes will install. Easy workaround.

jfsenechal commented 5 years ago

If you run php bin/phpunit all the PHPUnit classes will install. Easy workaround.

Nothing works for me,

CharlyPoppins commented 4 years ago

Try to create a phpstan.neon file in your project dir root and define the phpunit autoload file

# phpstan.neon
parameters:
  autoload_files:
    - bin/.phpunit/phpunit-7.5/vendor/autoload.php
neverdieTRX commented 4 years ago

If you run php bin/phpunit all the PHPUnit classes will install. Easy workaround.

worked for me too

jfsenechal commented 4 years ago

Me too Thank you

leymannx commented 4 years ago

For me it was composer require phpunit/phpunit 😅

bodik commented 4 years ago

here my 2 cents https://github.com/symfony/symfony/issues/36202#issuecomment-643751206

camerongreen commented 4 years ago

I'm just writing my first test on my first pure Symfony app, and I just couldn't find this file. You should probably be able to write a test when getting started with a framework without going to StackOverflow and a github issues page. Putting a neon file in with the version seems like a bit of a maintenance issue. Running phpunit seems hacky. Anyway will do, but think it would be good to come up with a better solution.