Skip to content
This repository has been archived by the owner on Aug 28, 2018. It is now read-only.

Define YamlLoader class in config.yml ilo hardcoded #18

Open
chess-server opened this issue Sep 4, 2012 · 3 comments
Open

Define YamlLoader class in config.yml ilo hardcoded #18

chess-server opened this issue Sep 4, 2012 · 3 comments

Comments

@chess-server
Copy link

Great Bundle! I am using it a lot to setup the base data of the application before populating the database with the data of the symfony1 application.
However, for test purposes, I would like to be in the position to load only a few fixtures,
The first tests should see an empty DB, then loading - test by test - the database from scratch, but test 1 would contain only 1 fixture, test 2 the first 2 or 3 etc. This would require to modify YamlLoader::loadFixtureFiles only.
I would like to create a class to extend YamlLoader and overwrite loadFixtureFiles and/or loadFixtures.
Can you make the bundle flexible enough to load a different class ilo Khepin\YamlFixturesBundle\Loader\YamlLoader to be specified in the config file? (cf FOSUserBundle)

@khepin
Copy link
Owner

khepin commented Sep 4, 2012

The "tag" functionality already allows you to do this and chose exactly which features you want to load. Or am I missing your point?

@chess-server
Copy link
Author

Am 04.09.2012 05:42, schrieb Sebastien Armand:

The "tag" functionality already allows you to do this and chose
exactly which features you want to load. Or am I missing your point?


Reply to this email directly or view it on GitHub
#18 (comment).

If I would need only one type of database setup, I could use the tags,
but the way I am setting it up I would need many tags. The idea is to
load test by test more fixtures:
BookControllerTest requires 001_book.yml
LanguageControllerTest requires 001_book.yml and 002_language.yml
CatalogueControllerTest requires 001_book.yml and 002_language.yml and
003_catalogue.yml
etc. etc.

@khepin
Copy link
Owner

khepin commented Sep 5, 2012

Ok, so normally if you only have one database it would still work.
If you have 2 (or more) databases and therefore (2 or more doctrine entity managers), then some works needs to be done.
If you don't use the "purge" option, you also could load things incrementally:

  • fixture set 1
  • fixture set 2 (while keeping fixture set 1)

etc...

If it still doesn't fit your needs, feel free to make a pull request to allow setting the loader through the config. Add a test. And then we're good to go.

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

No branches or pull requests

2 participants