@tsteur opened this issue on September 30th 2014

It is possible to generate a test via ./console generate:test. So far it is possible to generate a unit, database and integration test case. It would be nice to have the possibility to choose "command" as well. This would make it much easier to write tests for a command and the easier it is, the more likely we are writing tests for commands. Makes it also easier for plugin developers.

An example for such a command test is here: https://github.com/piwik/plugin-PiwikDebugger/blob/master/tests/Unit/ListEventObserversTest.php I think.

Alternatively, - maybe this is even better - when generating a command, we could also directly create a test file for this command. So we would kinda automatically write a test for it (maybe ;) ). Therefore we could create a test example in "ExampleCommand" plugin

@tsteur commented on September 30th 2014

Midterm maybe?

@diosmosis commented on September 30th 2014

Feel free to modify ConsoleCommandTestCase (it's in core). Never got around to doing anything serious w/ it, and I doubt I will at this point.

@tsteur commented on September 30th 2014

I'm ok with ConsoleCommandTestCase. It's only about providing a generator for it so that we do not have to create a file manually. Also plugin developers would probably not know such a test case exist and need some guidance

@mattab commented on September 30th 2014

Added to mid term though it seems important even for us to write tests easily...

Powered by GitHub Issue Mirror