PeO
PeO

Reputation: 103

phpUnit with Symfony

I have successfully setup a symfony 3.2.4 project with the following commands :

symfony new symfony_test
cd symfony_test
composer require --dev phpunit/phpunit ^6.0
composer update

Then I have the following error when I try to run the default test :

$ vendor/bin/phpunit tests/AppBundle/Controller/DefaultControllerTest.php

Fatal error: Class 'PHPUnit_Framework_TestCase' not found in C:\Users\po.louis\PhpstormProjects\test\symfony_test\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Test\KernelTestCase.php on line 23

What am I missing?

Upvotes: 4

Views: 501

Answers (2)

Alessandro Minoccheri
Alessandro Minoccheri

Reputation: 35973

Inside your composer.json edit

phpunit/phpunit ^6.0

to

phpunit/phpunit ^5.7

and all works fine.

As Matteo wrote to you isn't supported yet 6.0 version

Upvotes: 0

Matteo
Matteo

Reputation: 39460

Seems not possibile yet on same version of the framework, as announced in the last weekly update:

This week Symfony continued refactoring tests to make use of the new PHPUnit namespaces.

Hope this will be available on all the supported version.

Upvotes: 2

Related Questions