Bug Report #3456

Unit testing documentation ambiguity

Added by Mathew Davies about 4 years ago. Updated about 4 years ago.

Status:ClosedStart date:12/04/2010
Priority:NormalDue date:
Assignee:Matt Button% Done:

0%

Category:Modules:Unittest
Target version:v3.0.9
Resolution:fixed Points:

Description

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 phpunit.xml and 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.


Related issues

Duplicates Kohana v3.x - Bug Report #3369: Class 'PHPUnit_Framework_TestSuite' not found Closed 10/31/2010

History

#1 Updated by Matt Button about 4 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.

The phpunit.xml file is used to further simplify this by letting you run all tests without manually specifying the bootstrap as test_bootstrap.php

#2 Updated by Matt Button about 4 years ago

  • Status changed from New to Closed
  • Resolution set to fixed

Also available in: Atom PDF