Coder Social home page Coder Social logo

Comments (4)

jazithedev avatar jazithedev commented on June 16, 2024 1

Ok! Thank you @alexislefebvre for your help 🙂.

from liiptestfixturesbundle.

alexislefebvre avatar alexislefebvre commented on June 16, 2024

Hello 👋,
do you want to load fixtures only once before running tests, or before running each test? This bundle was designed for loading fixtures before each test.

For loading fixtures only once, you may be able to load the fixtures before running your test, and use DAMADoctrineTestBundle so that the database is not altered by the tests (the transaction will revert the changes automatically).

from liiptestfixturesbundle.

jazithedev avatar jazithedev commented on June 16, 2024

Yes, want to load fixtures only once before running tests 🙂. Currently I'm doing that with help of a separate Symfony bootstrap file, but that makes me not being able to access created fixture references unfortunately at the level of tests. Trying to figure it out whether there's a way to it 😁. But I'm assuming it's not possible with this bundle.

from liiptestfixturesbundle.

alexislefebvre avatar alexislefebvre commented on June 16, 2024

This bundle load the fixtures and return them:

$fixtures = $this->databaseTool->loadFixtures([
'Liip\Acme\Tests\App\DataFixtures\ORM\LoadUserData',
]);
$this->assertInstanceOf(
'Doctrine\Common\DataFixtures\Executor\ORMExecutor',
$fixtures
);
$repository = $fixtures->getReferenceRepository();
$this->assertInstanceOf(
'Doctrine\Common\DataFixtures\ProxyReferenceRepository',
$repository
);
$user1 = $repository->getReference('user');

Alternatively, you can access to the fixtures during the tests by using an id, email, etc. in order to fetch the fixtures you want. As long as you have access to the repository of your entity, you can fetch it.

from liiptestfixturesbundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.