I created a custom component loaded by Composer.
Here is the structure of my code when my component is loaded.
- MyProject
- vendor
- myComponent
- vendor
AFTER that, I created the file myComponentTest.php to run an unit test with Codeception.
- MyProject
- tests
- myComponentTest.php
- vendor
- myComponent
- tests
It works very well with the command :
./vendor/bin/codecept run
Alright. Nothing special about it. The Codeception test is ok ! :)
But I guess the procedure is wrong, the file myComponentTest.php should be in to the vendor/myComponent directory, am I right ?
Because, this unit test is only related to the component. For example, If I decide to remove the component, it won't remove my myComponentTet.php file, so I'll have some error when I'll run my unit tests.
BUT, if I move my MyComponentTest.php into the vendor/myComponent directory, I won't be able to run this test, because the Codeception command only execute tests from the tests directory.
So what should I do please ? I'm confused about that. Thanks.