4

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?

2
  • which version of the framework are you using? Commented Mar 1, 2017 at 13:34
  • You are testing the Symfony code from your project as well - and you will be pulling in a lot of other libraries as well, most of them (you'd hope) with many more tests. It will be useful to limit the tests you run to your own project/code (with phpunit.xml's 'whitelists'), and trust that the libraries (like Symfony) are well tested on their own - or go to the libraries and do a local composer install within them, to make sure you have all the support required. Commented Mar 1, 2017 at 17:26

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.