Symfony 4 – PHPUnit – Difficults with the setUp() method

  installation, php, phpunit, symfony, testing

I’m following the Symfony Cast Stripe formation. They use Symfony 3 and I use Symfony 4.

I try to make some test like in the formation :

But when I run the test, I’ve this error :

Fatal error: Cannot redeclare static
SymfonyBundleFrameworkBundleTestWebTestCase::$container as non
static AppTestsControllerWebhookControllerTest::$container in
on line 11

I made this :

namespace AppTestsController;

use DateTime;
use AppEntityUser;
use AppEntitySubscription;
use DoctrineORMEntityManagerInterface;
use SymfonyBundleFrameworkBundleTestWebTestCase;
use SymfonyComponentSecurityCoreEncoderUserPasswordEncoderInterface;

class WebhookControllerTest extends WebTestCase
    /** @var EntityManagerInterface */
    private $em;
    private $container;

    public function setUp()
        $this->container = self::$kernel->getContainer();
        $this->em = $this->container->get('doctrine')->getManager();
    // ...

Can someone help me please ?

Source: Symfony Questions