I don't really see the problem with AOP and unit testing.. You still only test your original class. In addition you also test the Aspect in isolation. If both pass their tests, it should be safe to assume that they will also work in conjunction.
Similarly, when you write a class that dispatches events, all you can test for is that events are being dispatched correctly.. you can't test for whether the handler messes up. I for my part would love some AOP support, primarily to add logging and potentially transaction handling, in my case. Great to see that this is already possible. Perhaps all that is needed at this point is an easy way to integrate the Go! library into Symfony (service tags, etc). Daniel On Monday, December 3, 2012 1:39:26 PM UTC-8, Larry Garfield wrote: > > On 12/3/12 1:36 AM, Victor Berchet wrote: > > On 12/03/2012 08:26 AM, Larry Garfield wrote: > >> Be very careful with that. AOP is a flame thrower; very powerful, but > >> can also burn you quite badly. If you're not extremely careful, it > >> can make effective unit testing next to impossible. > > Larry, could you please give more details on why it could made > > "effective unit testing next to impossible" ? > > > > Cheers, > > Victor > > Disclaimer: The only AOP system I've worked in is Drupal, so my > perspective is somewhat skewed. I've already read about how AOP has > been implemented in some .NET systems, which is where the rest of my > knowledge comes from. I do not claim to be an expert on the subject. > > Basically, though, adding an aspect implicitly to a class means that you > don't know what aspects have been added, which means you don't have > complete control over your environment, which means you cannot carve out > a "unit" to test. (This is one of the key problems keeping most Drupal > from being properly unit testable.) > > If you add an aspect to an object explicitly, then I really don't see > how it's any different from EventDispatcher. > > The line between AOP and events is, in my understanding, somewhat fuzzy > to begin with. > > --Larry Garfield > -- 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 symfony-devs@googlegroups.com To unsubscribe from this group, send email to symfony-devs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en