-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request for feature: Service layer #66
Comments
We are planning for v2 to address these concerns. I am currently working on a rewrite of the current v2 foundation to make things like this possible. I also intend to provide test harnesses for phpunit as well as a codeception module to allow for easy testing, but this won't happen until we are happy with the state of the core request/response code. |
Is there a planned release date, or it will be released when it is ready. Can I get involved especially in the Service layer development, if it is still TODO or under development? |
As of yet there is no planned release date. We will make official announcements when we are ready to release. As it stands the v2 code has a concept of this built in, as far as I understand what you are asking for, provided via fuelphp/dependency. My current task is getting routing up and working, and as part of that I am going to set it up so controllers can be configured to have services automatically injected when they are initialised. |
Yes, that is exactly how I would expect it to be. |
Good, sounds like there's nothing extra to do here then :) |
I have struggled with unit testing controllers. In my personal opinion, AspectMock is pretty tricky and takes much time to be configured. I need something quick, easy to extend, showing results asap, especially when I need to test data with logged user.
Yet, controllers, as they are supposed to, return (in most cases) html with response status, rather than simple data or anything testable - not that they are not important, but I find that this is also tested during development, so it may be left out in the unit testing.
Still I need to test the data I get from the models.
I have some experience with ASP.NET and Java EE, where it is considered good practice to separate the (so called) business logic from the controller and model in another layer - Service Layer. This way the work is done as follows:
Personally I find it simpler to keep the validation of input fields in the controller, rather than move it to the service. The service should only modify, no need to validate inputs.
Please do check the sample code I have uploaded at my https://github.com/archlicher/fuelphp_req_4_feat. For brevity I have uploaded only the controller and the service, as they are the only piece of software that I have changed. (Notice! if you are to try it with your own project, don't forget to add the Service namespace and classes to your config and bootstrap files).
Finally I wish to point out a few pros:
As it is quite simple and I must have surely missed out some pivotal points, way will not be the best, still I do believe there are reasons to put some thought in to it.
The text was updated successfully, but these errors were encountered: