Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebTestCase and FixturesTrait define the same property ($containers) #589

Open
craigh opened this issue Aug 9, 2021 · 4 comments
Open

Comments

@craigh
Copy link

craigh commented Aug 9, 2021

I am trying to upgrade my app to Symfony 5.3. Previously this worked in 5.2.11 with functional-test-bundle 4.4.0 and test-fixtures-bundle 1.11.2. After upgrading to most recent versions of all, I get the error below:

PHP Fatal error: Liip\FunctionalTestBundle\Test\WebTestCase and Liip\TestFixturesBundle\Test\FixturesTrait define the same property ($containers) in the composition of App\Tests\AbstractFixtureWebTestCase. However, the definition differs and is considered incompatible. Class was composed in /var/www/symfony/tests/AbstractFixtureWebTestCase.php on line 14

This is the same error as #548 but obviously - much more recent versions.

Preconditions

  1. PHP 7.4.22
  2. Symfony 5.3.4
  3. liip/functional-test-bundle 4.4.2
  4. liip/test-fixtures-bundle 1.12.0

Steps to reproduce

namespace App\Tests;

use Liip\FunctionalTestBundle\Test\WebTestCase;
use Liip\TestFixturesBundle\Test\FixturesTrait;

abstract class AbstractFixtureWebTestCase extends WebTestCase
{
    use FixturesTrait;

Expected result

  1. these two bundles should work together as before

Actual result

PHP Fatal error: Liip\FunctionalTestBundle\Test\WebTestCase and Liip\TestFixturesBundle\Test\FixturesTrait define the same property ($containers) in the composition of App\Tests\AbstractFixtureWebTestCase. However, the definition differs and is considered incompatible. Class was composed in /var/www/symfony/tests/AbstractFixtureWebTestCase.php on line 14

@craigh
Copy link
Author

craigh commented Aug 9, 2021

also upgraded in this process:

  • Upgrading phpunit/phpunit (9.5.6 => 9.5.8)
  • Upgrading symfony/phpunit-bridge (v5.3.3 => v5.3.4)

@alexislefebvre
Copy link
Collaborator

Please try with LiipTestFixturesBundle 2 : composer require --dev liip/test-fixtures-bundle:^2.0.0-RC1 The upgrade guide is here.

@craigh
Copy link
Author

craigh commented Aug 10, 2021

I have upgraded to 2.0.0-RC1 and changed my code and it seems to work.

Although - I'm not sure upgrading is an actual solution for the existing versions.

Trying to reach you on slack. thanks

@alexislefebvre
Copy link
Collaborator

LiipTestFixturesBundle v1 uses a trait, which cause conflicts with the test bundle. LiipTestFixturesBundle v2 doesn't use a trait, it's easier to use both bundles. So yes it doesn't fix the issue on current version but it will avoid it in the long run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants