Bug Report #3456
Unit testing documentation ambiguity
|Assignee:||Matt Button||% Done:|
For unit testing, there are two ways to run the tests.
From the guide:
$ phpunit --bootstrap=index.php modules/unittest/tests.php
Running in this 3.0.8 didn't work for me and resulted in the following errors.
PHP Fatal error: Call to undefined method PHPUnit_Util_Filter::addFileToFilter() in /var/www/nolimits/public/modules/unittest/classes/kohana/tests.php on line 143 ErrorException [ 1 ]: Call to undefined method PHPUnit_Util_Filter::addFileToFilter() ~ MODPATH/unittest/classes/kohana/tests.php [ 143 ]
In the application directory you have a
test_bootstrap.php file which are never mentioned in the guide.
This makes it a bit confusing as to which is the correct way.
The 2nd way (
phpunit.xml) works for me. Maybe it should be updated.
#1 Updated by Matt Button over 3 years ago
This was a compatibility issue with PHPUnit 3.5, however the point you make about ambiguity is correct.
If you've enabled the unittest module in your
bootstrap.php then you can run it with
--bootstrap=index.php, however when we're developing for kohana itself the unittest module is disabled in the bootstrap so we use test_bootstrap to provide a quick and easy way to enable it without all the "edit this file before you run tests" faff.
phpunit.xml file is used to further simplify this by letting you run all tests without manually specifying the bootstrap as