liip / LiipFunctionalTestBundle

Some helper classes for writing functional tests in Symfony

Home Page:http://liip.ch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[2.x] Symfony 4.3.1 - Symfony\Bundle\FrameworkBundle\Client already exists

lsv opened this issue · comments

Preconditions

  1. 2.0@alpha (alpha16)
  2. 464c7a2

Steps to reproduce

https://github.com/liip/LiipFunctionalTestBundle/blob/2.0.0-alpha16/src/Test/WebTestCase.php#L575-L578

So maybe also check if the class Symfony\Bundle\FrameworkBundle\Client already exists?

Everything works normal if I add && !class_exists('Symfony\Bundle\FrameworkBundle\Client')

The Symfony\Bundle\FrameworkBundle\Client class exists in 4.3.1, so we get a

Fatal error: Uncaught Cannot declare class Symfony\Bundle\FrameworkBundle\Client, because the name is already in ./vendor/liip/functional-test-bundle/src/Test/WebTestCase.php on line 577

Removed the following directories to see if this was the problem

  • var/cache
  • bin/.phpunit
  • bin/symfony cache:clear --env=test

But still the same problem.

This should work if you downgrade to 2.0.0-alpha15 or use Symfony 4.3.0.

The BC layer is not correct, the condition should be the reverse:

// Compatibility layer for Symfony 4.3+
if (!class_exists('Symfony\Bundle\FrameworkBundle\Client')) {
    class_alias('Symfony\Bundle\FrameworkBundle\KernelBrowser', 'Symfony\Bundle\FrameworkBundle\Client');
}

But as the classes is re-introduced on Symfony 4.3.1, I suggest to just remove the BC layer and add a conflict rule for symfony 4.3.0.

Please see #527

Fixed in #527, please reopen the issue if the problem is not fixed.