Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How to setup PHPUnit test with multi module setup

I have created a test application with single setup and used PHPUnit as per tutorial http://docs.phalconphp.com/en/latest/reference/unit-testing.html and it works well.

Can anybody help me how do I setup it for multi module setup?



5.9k

Hi,

If you want to do unit test make sure your code is SOLID compliant. And it would me useful if you show us part of code that you want to test

I am ok to write the unit tests, my question was how do i setup phalcon to work with phpunit while using multimodule setup. See the link http://docs.phalconphp.com/en/latest/reference/unit-testing.html, the steps are given for single module setup.



5.9k
Accepted
answer

It unit test it doesnt care wheter you apps is single or multimodule. Given example just give you DI and config in test suite. For example if you want to test AddUser function in UserModule, you have to create User object and mock its dependency. then call it in unit test

$user = new \App\Module\User\User.php;
$this->assertTrue($user->addUser());

Thank you Prasetyo.