I'm using Symfony 2.8 (latest) for an web-application where every part of the application which could be used alone / reused is an own bundle. For example there is a NewsBundle, GalleryBundle, ContactBundle, AdminBundle (this is a special case - it's only a wrapper-bundle for EasyAdminBundle collecting the traits provided by the specific bundles), UserBundle (Child bundle of FOSUserBundle storing user-entity and templates)
My question is basically, whats the best structure for unit-tests?
Let me explain it a little bit more: In my UserBundle I want to make tests for my implementation of FOSUserBundle. I have a method testing the login-page (via HTTP status-code), login-failure (via error-message), login-successful (via specific code-elements), remember-me (via Cookie), logout (via page-content)
All this tests will be done in one method because if I would do it in different methods I would have an high amount of duplicated code. Does this follow the best practice? What is the best practice for separating unit-tests?
Part two of the question: Is there a possibility to provide helper-functions for test-classes or something working similar to it? I mean methods as example which provide an logged in client. This would be needed for admin function-tests.
Aucun commentaire:
Enregistrer un commentaire