I’ve used yii2 for years, and I’m familiar to test yii2 application. As yii2-basic-app does, the tests directory is put under the application directory.
Since our project is becoming larger and larger, more and more modules are created. But because there’s no explicit dependency definition between modules, the module developers tend to use classes and functions from other module arbitrarily, which can greatly increase the project complexity that can make the project unmaintainable in the future.
So, currently, our team is shifting modules to composer packages. With explicitly defined dependency, it’s easy to constrain developer only call classes and functions in pre-defined packages.
But, the testing problem emerges.
In the yii2-basic-app, there’s only one tests directory, every testing and config file should be put under that directory.
However, when modules and features are developed in isolated packages, it’s apparent that we should put the testing file under its own package.
The question is, how to manage the testing files and successfully running the tests under such a circumstance?