Hi,
I have a class I would like to unit/functional test that uses several propel model classes that are used to write to the db (in this scenario I am not getting any data out of the db). At this point I am not worried about checking if data actually ends up in the db, I will rely on propel to do its job. So what I really want is the ability to inject fake model objects that do not actually write to the database when I am running a unit test. The fake model could be a class derived from the actual model where the save method is overridden and simply returns 0 (or whatever other value I want) and does nothing else. The problem I am having is how to go about injecting the fakes. I don't really want to have to pass a reference of all model objects into my object because I sometimes need multiple instances of the same class. So what I would need is for the class I am testing to know which model class to instantiate (MyModelReal or MyModelFake). To follow a good design principle of decoupling dependencies it would probably be a good idea to not even have the model object construction inside my object in the first place, but rather use a factory that knows how to construct model objects and is environment aware (if running in test it would construct fakes and otherwise the 'real' models). I know of http://components.symfony-project.org/dependency-injection/. It is not part of sf 1.2.x. Has anyone used this in sf 1.2.x? Does anyone have other suggestions on how to implement something like this? Thanks Henning --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
