Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Class 'PHPUnit_Framework_TestCase' not found #21816

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

Closed
fabienlem opened this issue Mar 1, 2017 · 7 comments
Closed

Class 'PHPUnit_Framework_TestCase' not found #21816

fabienlem opened this issue Mar 1, 2017 · 7 comments

Comments

@fabienlem
Copy link

Q A
Bug report? yes
Feature request? no
BC Break report? probably
RFC? no
Symfony version 3.2.4

Hello symfony's team,

I'm experiencing an issue with Symfony 3.2.4. I want to implement functionnal tests by following this documentation: http://symfony.com/doc/current/best_practices/tests.html

When I run the test with the following command:
phpunit tests/AppBundle

I got an error:
Class 'PHPUnit_Framework_TestCase' not found

I'm using the latest stable PHPUnit version, installed as PHAR.

Is it a bug or did I missed something? I can't find further information about this issue.

Thank you a lot for your help.

Kind regards,
Fabien

@theofidry
Copy link
Contributor

Hi, this is happening because you are probably using PHPUnit 6 which no longer supports PHPUnit_Framework_TestCase and has been replace by PHPUnit\Framework\TestCase. See https://thephp.cc/news/2017/02/migrating-to-phpunit-6 for more information.

@fabienlem
Copy link
Author

Hi @theofidry,

That was it! Now everything works as expected.

Thank you a lot 👍 I'm closing this issue.

Regards,
Fabien

@xabbuh
Copy link
Member

xabbuh commented Mar 1, 2017

@fabienlem Thanks for reporting your issue anyway. We will update the documentation in symfony/symfony-docs#7556 to reflect these changes in PHPUnit.

@stof
Copy link
Member

stof commented Mar 1, 2017

@xabbuh don't spend too much time on this. Next releases (in all branches) will be compatible with PHPUnit 6

@xabbuh
Copy link
Member

xabbuh commented Mar 1, 2017

@stof I know. The docs PR just updates the examples to not use the old classes anymore (but use the namespaced classes instead).

digitalica added a commit to digitalica/msxcomputermagazine that referenced this issue Jan 17, 2019
@Yigaue
Copy link

Yigaue commented Nov 27, 2019

This was helpful

@rejuancse
Copy link

// use the following namespace
use PHPUnit\Framework\TestCase;

// extend using TestCase instead PHPUnit_Framework_TestCase
class SampleTest extends TestCase {

}

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

6 participants