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

Load fixture files recursively #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

j4k4
Copy link

@j4k4 j4k4 commented Jul 1, 2015

Hi, i've changed the YamlLoader to be able to load the fixture files from the directory recursively.
In addition, the files of a bundle will be sorted by filename. This makes it possible to create an order in which the files will be loaded.
.
├── 000_books.yml
├── 001_users.yml
├── 002_reviews.yml
├── test1
│   ├── 001_additional_users_for_test1.yml
│   └── 002_additional_reviews_for_test1.yml
└── test2
└── 000_additional_books_for_test2.yml

This directory would be loaded in the following order:

  1. 000_books.yml
  2. 000_additional_books_for_test2.yml
  3. 001_users.yml
  4. 001_additional_users_for_test1.yml
  5. 002_reviews.yml
  6. 002_additional_reviews_for_test1.yml

This loading strategy makes it easier to maintain large sets of fixture data.

… recursively from the specified directory.
@khepin
Copy link
Owner

khepin commented Jul 2, 2015

I feel this is where I'd draw a line to keep the module simple. This loading strategy is specifically tailored to what you are doing and I'm not sure others would have a need for it.
If you could find a way to plug in any loading strategy to replace the default one, where you could then keep your own or others could create a different one, that might be better.

If you get around to writing something like that and it is simple enough (keeps the current behavior as default) and has tests and documentation, I'd merge that.

@j4k4
Copy link
Author

j4k4 commented Jul 3, 2015

Hehe, ok, i understand your concerns..
One could implement the loading as a service, so that the loader could be injected through the service container, with the current strategy as the default service.
If this is fine with you, i could try to implement this in the near future..

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

Successfully merging this pull request may close these issues.

2 participants