Respect Boundaries Strict border
Remember to respect responsibility boundaries. Controllers and routes serve as a mediator between HTTP and your application. When writing large applications, don ' t clutter them up with your domain logic.
Remember to maintain clear boundaries of responsibility. The controller and the route are used as middleware between HTTP and your application. When writing large applications, do not mix your domain logic (Controller, routing).
To solidify we understanding, let ' s write a quick test. First, we'll mock the repository and bind it to the application IoC container. Then, we'll ensure that the controller properly calls the repository:
In order to consolidate the knowledge learned, let's write a test case. First, we will simulate a database and then bind it to the IOC container of the application. We then make sure that the controller correctly calls the database:
Public Function Testindexactionbindsusersfromrepository () { //Arrange ... $repository = Mockery::mock (' userrepositoryinterface '); $repository->shouldreceive (' All ')->once ()->andreturn (Array (' foo '));}
Asdasd
Class A
From apprentice to Artisan translation 02