Ticket #165 (closed enhancement: fixed)

Opened 9 months ago

Last modified 9 months ago

Add support for PHPUnit_Framework_TestSuite subclasses in fileset of test classes

Reported by: hans Assigned to: hans
Priority: major Milestone: 2.3.0
Component: phing-tasks-phpunit Version: 2.3.0RC1
Keywords: Cc:

Description

From Dirk Thomas:

when i try to use a class which extends PHPUnit_Framework_TestSuite in the fileset of a php unit task, i am unable to run the tests defined in that suite. With subclasses of PHPUnit_Framework_TestCase everything works fine.

I poked a little bit around in the PHPUnitTask. For me it looks like a problem in the main-methode. Inside of the loop 'foreach ($tests as $test)', which executes all the tests, the first condition seems to be problematic.

In my case the variable $test is the name of my subclass of TestSuite. Therefore the condition 'is_subclass_of(..)' is true. But just using the string as the argument for the later execute won't work, since PHPUnit can only handle strings of TestCases in that way. If $test is an object this would work well.

<snip>

I modified the inner part of the if-block (line 213 in PHPUnitTask.php). If $test is just a string (no object) just call its constructor to get an instance. This works since it was tested on "is_subclass_of($test, 'PHPUnit_Framework_TestSuite')" before.

Attachments

PHPUnitTask_allow-suitename.patch (474 bytes) - added by hans on 10/17/07 13:20:19.

Change History

10/17/07 13:20:19 changed by hans

  • attachment PHPUnitTask_allow-suitename.patch added.

10/17/07 13:28:23 changed by hans

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in r255 (2.3) and r254 (trunk)


Add/Change #165 (Add support for PHPUnit_Framework_TestSuite subclasses in fileset of test classes)




Action