Test generator should be able to place the test in a sub folder #6783
Labels
c: Platform
For Matomo platform changes that aren't impacting any of our APIs but improve the core itself.
c: Tests & QA
For issues related to automated tests or making it easier to QA & test issues.
Enhancement
For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Milestone
And adjust Namespace and maybe add a group for each part of the namespace.
When executing the command to generate a test we ask to enter the name of a test. What we actually want to know is the name of the class a user wants to test as it is best practice to name the test the same as the class name. Therefore we should adjust this question to "Which class do you want to test". Maybe we could even offer autocompletion by detecting all classes within the previously selected plugin?
Let's assume you want to unit test the class
Piwik\Plugins\QueuedTracking\Queue\Backend\Redis
then the command should create a test inplugins/QueuedTracking/tests/Unit/Queue/Backend/RedisTest.php
and add the groups@group Queue @group Backend @group Redis
. It should accept the full qualified class name or, as we already know the name of the plugin, onlyQueue\Backend\Redis
.Maybe we could also automatically detect if someone wants to generate a test for a
/core
class then we could automatically create a test intests/PHPUnit
instead of in the plugin.Currently I always have to do this manually
The text was updated successfully, but these errors were encountered: