Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test generator should be able to place the test in a sub folder #6783

Open
tsteur opened this issue Dec 2, 2014 · 2 comments
Open

Test generator should be able to place the test in a sub folder #6783

tsteur opened this issue Dec 2, 2014 · 2 comments
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.

Comments

@tsteur
Copy link
Member

tsteur commented Dec 2, 2014

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 in plugins/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, only Queue\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 in tests/PHPUnit instead of in the plugin.

Currently I always have to do this manually

@tsteur tsteur added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. labels Dec 2, 2014
@mattab
Copy link
Member

mattab commented Dec 3, 2014

definitely Short term - it's a bit confusing now where to add @group etc. and nobody knows the right way. I guess such nice command is the only way to ensure everyone does thing consistently 👍

@mattab mattab added this to the Short term milestone Dec 3, 2014
@mattab mattab added the c: Tests & QA For issues related to automated tests or making it easier to QA & test issues. label Dec 3, 2014
@tsteur
Copy link
Member Author

tsteur commented Dec 3, 2014

could even create a little script that removes all core and plugins groups and instead adds more useful groups like the classname and / or parts of the namespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

2 participants