Mocking to be allowed for all services - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29) +--- Thread: Mocking to be allowed for all services (/showthread.php?tid=78985) |
Mocking to be allowed for all services - gmeister2 - 04-05-2021 Context There are 2 helpers to load a service:
Services::injectMock('example', $example); This is not clear in the documentation, I assumed mocking would work for all services: Testing / Getting Started / Mocking Services Feature Request: The framework looks for all service mocks instigated, either for:
in app/Config/Services.php PHP Code: public static function example(bool $getShared = true) |