I have a error with PHPUnit using Symfony2
In my test case I import:
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
But, when I execute it I get:
PHP Fatal error: Class 'Symfony\Bundle\FrameworkBundle\Test\WebTestCase' not found in C:\trabajo\web\Company\src\Company\WebBundle\Tests\dbTest.php on line 11
I use to execute it:
phpunit -c app/ src/Company/WebBundle/Tests/dbTest
Any help?
Thanks in advance.
This is because to execute the test case with CLI you need to provide
/app/bootstrap.php.cache
app/phpunit.xml.dist
So the command would be like below:
phpunit --configuration app/phpunit.xml.dist ----bootstrap /app/bootstrap.php.cache
Bootstrap can be provided in phpunit.xml.dist as well within <phpunit>
tag.
The other option assuming you have good phpunit.xml.dist file is to go to app directory and there execute the tests.
You may adjust the paths to your needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With