Allow insertion of test data from the current Migration #47

Closed
josegonzalez opened this Issue Feb 9, 2012 · 3 comments

Comments

Projects
None yet
3 participants
Contributor

josegonzalez commented Feb 9, 2012

It would be useful to auto-inject data into a migration for the purposes of testing - we could turn off the injection via a flag for application-specific environments - in a similar format as what Fixture class uses. We could simply wrap around the same system for adding/removing data, as well as optionally allowing users the ability to drop all existing data.

Thanks Jose

Contributor

burzum commented Mar 22, 2012

This is no feature that really belongs directly into this plugin and even what you suggest is not a good idea. Migrations are thought to evolve the database schema over a migrations live cycle. What you want is a testing feature and this can and should be done separate by using a shell for example. You can re-use the fixtures as you suggested for that. I would do it with a shell like "cake testdata inject" and "cake testdata flush".

If you still want to do to it using migrations you can read the fixture data in the before and after callbacks of a migration.

burzum closed this Mar 22, 2012

It would be good to be able to extend it with test data though ;) I'll work on something in a fork.. taa taa!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment