I try to write a functional test for my app but I am getting following error:
InvalidArgumentException: The option "test_case" must be set.
I tried googling for it but found literally no clues.
My code:
class WhateverTest extends WebTestCase {
public function testWhatever() {
$client = static::createClient();
$crawler = $client->request('GET', '/home');
$this->assertEquals(1, 1);
}
in phpunit.xml the kernel is set
<php>
<server name="KERNEL_DIR" value="app/" />
</php>
My AppKernel
has just two functions: registerBundles()
and registerContainerConfiguration
Check which WebTestCase
class you are using. Most probably you are using
use Symfony\Bundle\FrameworkBundle\Tests\Functional\WebTestCase
and you should be using
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
So just change this one line and you should be good
you may have mistakenly used
Symfony\Bundle\SecurityBundle\Tests\Functional
or
Symfony\Bundle\FrameworkBundle\Tests\Functional\WebTestCase
instead of
Symfony\Bundle\FrameworkBundle\Test\WebTestCase,
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