PHPUnit in fresh Symfony 3 installation

I installed Symfony 3 with the command line as they show in their documentation, and installed PHPUnit.

phpunit --version
PHPUnit 6.0.6 by Sebastian Bergmann and contributors.

When I run phpunit in the command line, I get this error:

PHP Fatal error:  Class 'PHPUnit_Framework_TestCase' not found in D:\symfony\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Test\KernelTestCase.php on line 23

Thanks in advance for any help

Upvotes: 1

Views: 594

Answers (2)

Leszek
Leszek

Reputation: 182

You can change PHPUnit to 5.7 version, as LBA suggest but this is not solution.

This error message simply tells you that you should replace:

use PHPUnit_Framework_TestCase;

with

use PHPUnit\Framework\TestCase;

works for me!

Upvotes: 1

LBA
LBA

Reputation: 4109

This is an issue related to PHPUnit 6 and a known 'bug' or incompatibility with Symfony (the background is that PHPUnit 6 expects and only supports PHP7 while Symfony 3 still supports lower PHP versions).

I suggest to use PHPUnit 5.7 as a workaround for now.

See this issue description/discussion on Github

Upvotes: 3

Related Questions