Before You Submit
Type of Suggestion
Proposing new documentation content
Relevant Documentation Links
https://docs.nextcloud.com/server/latest/developer_manual/basics/testing.html#php
Summary
Explicitly state how to realize dependency injection for unit and integration tests
Details
The DI framework in NC is nice and works out of the box without manual configuration by the app devs. However, when testing classes using PHPUnit, the DI framework is not available. That is okay for simple unit tests that only rely on a few classes that can be mocked/stubbed.
However, once integration tests should be carried out or larger class structures should be addresses, the DI is very handy. In the example, there is a way presented to get the app container from the application class. I would like to see this more verbose and more present.
Additional Notes
I might write this myself. Here just to keep track...
Before You Submit
Type of Suggestion
Proposing new documentation content
Relevant Documentation Links
https://docs.nextcloud.com/server/latest/developer_manual/basics/testing.html#php
Summary
Explicitly state how to realize dependency injection for unit and integration tests
Details
The DI framework in NC is nice and works out of the box without manual configuration by the app devs. However, when testing classes using PHPUnit, the DI framework is not available. That is okay for simple unit tests that only rely on a few classes that can be mocked/stubbed.
However, once integration tests should be carried out or larger class structures should be addresses, the DI is very handy. In the example, there is a way presented to get the app container from the application class. I would like to see this more verbose and more present.
Additional Notes
I might write this myself. Here just to keep track...