PhpUnit with Symfony

I successfully installed the 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, when I try to run the test by default, I have the following error:

$ 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?

+4
source share
2 answers

It seems as long as the same version of the framework does not exist, as announced in the last weekly update :

Symfony continued refactoring tests this week to use the new PHPUnit namespaces.

We hope that this will be available for all supported versions.

+2
source

Inside your composer.json edit

phpunit/phpunit ^6.0

to

phpunit/phpunit ^5.7

and everything is working fine.

As Matteo wrote, version 6.0 is not yet supported for you.

0

Source: https://habr.com/ru/post/1671141/


All Articles