Well, I hate IRC, so I'll post here instead. I'm working on patches for countModules - so I switched gears for the moment. Here is the process I am using:
gmJoomla\joomla-platform - my github clone of the joomla-platform
my branches:
-->evalFix: my initial pass on coding a fix for this untested method
-->countModulesUnitTests: a new clean branch for just adding the unit tests
I need to rewrite the evalFix patch, but have put that on hold and am working on the unitTests as a seperate patch/pull request. Is this the correct process[submit unit tests seperately, then fixes] - or should they be combined?
My pull request:
I've added tests, so this code now has unit test coverage. These tests are not yet complete because there are many other conditions which need testing - so I changed the "this test has not been implemented" text mark to "this test has not been completed".
Because there are so MANY conditions to test for to provide an adequate level of coverage, I've only included 17 new tests out of approximately 50 tests which are needed.
Some questions I have if anyone knows the answer, otherwise I'll look them up later:
There are times when we need to determine if the result of a test was boolean or integer. Ie sometimes it returns false, and sometimes it returns 0. Is the PHPUnittest method isEqualTo sufficient or do I need to use a different method there?
There is one test where there won't be a return value, but instead an exception will be thrown[if your countModules parameter is 'dummy1 / dummy2' and the dummy2 position is empty, then that is a divide by zero exception] - how do you catch exceptions in unitTests for testing?
Lastly, is the correct process so far? And will partial implementations of unit tests be accepted? It's rather tedious and tiresome to write 50+ conditions before knowing if your even doing things correctly, so getting the first 17 in would at least provide motivation and guidance for the remaining 30+. :-)