Testable Controllers with dependencies

前端 未结 3 928
无人及你
无人及你 2021-01-30 23:47

How can I resolve dependencies to a controller that is testable?

How it works: A URI is routed to a Controller, a Controller may have dependencies to pe

3条回答
  •  情话喂你
    2021-01-31 00:18

    Aspect-Oriented Programming can give your solution for mocking methods even with Service Locator pattern. Look for the AspectMock testing framework.

    1. Github: https://github.com/Codeception/AspectMock
    2. Video by Jeffrey Way: http://jeffrey-way.com/blog/2013/07/24/aspectmock-is-pretty-neat/

提交回复
热议问题