-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Hello everyone!
This issue is a proposal: it's an idea I give because I implemented it and I find it useful. I would like to share it and ask opinions as I think it would be a great improvement in Symfony2 tests usage.
The problem
The testing capabilities of Symfony are very useful, especially when it comes to functonnal testing.
It promotes testing in PHP applications and it's great.
However, I think there is a problem with the current implementation: it too low-level (and Behat is much too complex to set up for beginners).
The classic example is the authentication in tests: the doc is great but let's be honest, having to include 10 lines of obscure code is not really easy and intuitive.
The idea
The idea is to implement useful helpers in WebTestCase
class. For the moment, the helpers I can think of would be:
- a login helper, as presented here : http://symfony.com/doc/current/cookbook/testing/simulating_authentication.html ;
- a crawler filter for the content (globally, it would in fact do a XPath filter on
html:contains(xxx)
) - a simpler way to select and send forms (the ideal would be in a line of code) ;
It is an idea to debate. What do you think?