Skip to content

[2.0] Cannot load dependent fixtures that needs dependency injection #411

Closed
@magnetik

Description

@magnetik

Using DoctrineFixtures and LiipFunctionalTestBundle.
Let's say I've FooFixtures that requires BarFixtures and BarFixtures requires a service injected in it's constructor.

In my test, I use $this->loadfixtures([FooFictures::class]);.
This ends up in the FixturesLoaderFactory line 65: $loader->addFixture($fixture);
This calls the \Doctrine\Common\DataFixtures\Loader line 136 that tries to manage dependencies: elseif ($fixture instanceof DependentFixtureInterface) { $this->addFixture($this->createFixture($class));

So if my BarFixtures needs a service in the construct, it cannot be instantiated.

Should the SymfonyFixturesLoader from the DoctrineFixtureBundle be used?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions