Hmm, maybe some pseudo-code could help me get my head around it:) On Tue, Oct 5, 2010 at 1:08 PM, Lukas Kahwe Smith <[email protected]>wrote:
> > On 05.10.2010, at 16:58, Bulat Shakirzyanov wrote: > > > Hi Lukas, > > > > I personally don't think its possible to refactor the mock setup and > reduce duplication. > > It might seem annoying that you have to instantiate mocks all the time > and pass 6-7 parameters, but the mocks are very domain specific, as they are > to test how your application interacts with them. > > Therefore, depending on circumstances, you might want to mock all methods > or just a couple, you might want to invoke constructors or original methods > or not - everything is very very domain specific and I don't see a universal > cure. > > I do refactor my tests suites, by extracting common mock instantiation > first into dedicated methods inside the test class, and then into bundle > specific dedicated test cases (ForumBundleTestCase) that most of my bundle > specific tests then extend. > > I didnt make it clear, but I specifically did not want to automate the > method mocking, just the objects themselves. Now in terms of adding > expects() calls, for shared services it should be easy to just get the > service and add the expects() call. For non shared, it would be cool to be > able to have some way to define a (set of ) instances to use next maybe. > > But also remember there is more than just services, there are also > parameters and here again it would be nice to have the testing DIC just give > you what is configured instead of having to repeat this in all the tests. > > Also remember since one has access the the DIC, its always possible to > change configuration at runtime. > > regards, > Lukas Kahwe Smith > [email protected] > > > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<symfony-devs%[email protected]> > For more options, visit this group at > http://groups.google.com/group/symfony-devs?hl=en > -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony developers" 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-devs?hl=en
