Ticket #273 (closed feedback: fixed)
PHPUnit 3.3RC1 error in phpunit task adding files to filter
| Reported by: | silfreed@… | Owned by: | mrook |
|---|---|---|---|
| Priority: | major | Milestone: | 2.4.0RC1 |
| Component: | phing-tasks-phpunit | Version: | 2.3.1RC1 |
| Keywords: | Cc: | phingbug@… |
Description
PHPUnit 3.3RC1 throws an exception in PHPUnit_Util_Filter::addFileToFilter() which is used in PHPUnitTask.php to ignore certain files. Apparently the files being passed to this function aren't correct since the files can't be found and the exception is thrown.
It looks like this can be fixed by specifying the relative path to the files based on the path of the current file like in this patch.
-Doug
Index: PHPUnitTask.php
===================================================================
RCS file: /cvs/hovercraft/sandbox/php/pear/phing/tasks/ext/phpunit/PHPUnitTask.php,v
retrieving revision 1.2
diff -u -b -r1.2 PHPUnitTask.php
--- PHPUnitTask.php 27 Aug 2008 17:24:50 -0000 1.2
+++ PHPUnitTask.php 10 Sep 2008 16:45:10 -0000
@@ -104,6 +104,7 @@
/**
* Add some defaults to the PHPUnit filter
*/
+ $pwd = dirname(__FILE__);
if (PHPUnitUtil::$installedVersion == 3)
{
require_once 'PHPUnit/Framework.php';
@@ -114,26 +115,26 @@
define('PHPUnit_MAIN_METHOD', 'PHPUnitTask::undefined');
}
- PHPUnit_Util_Filter::addFileToFilter('PHPUnitTask.php', 'PHING');
- PHPUnit_Util_Filter::addFileToFilter('PHPUnitTestRunner.php', 'PHING');
- PHPUnit_Util_Filter::addFileToFilter('phing/Task.php', 'PHING');
- PHPUnit_Util_Filter::addFileToFilter('phing/Target.php', 'PHING');
- PHPUnit_Util_Filter::addFileToFilter('phing/Project.php', 'PHING');
- PHPUnit_Util_Filter::addFileToFilter('phing/Phing.php', 'PHING');
- PHPUnit_Util_Filter::addFileToFilter('phing.php', 'PHING');
+ PHPUnit_Util_Filter::addFileToFilter($pwd.'/PHPUnitTask.php', 'PHING');
+ PHPUnit_Util_Filter::addFileToFilter($pwd.'/PHPUnitTestRunner.php', 'PHING');
+ PHPUnit_Util_Filter::addFileToFilter($pwd.'/../../../Task.php', 'PHING');
+ PHPUnit_Util_Filter::addFileToFilter($pwd.'/../../../Target.php', 'PHING');
+ PHPUnit_Util_Filter::addFileToFilter($pwd.'/../../../Project.php', 'PHING');
+ PHPUnit_Util_Filter::addFileToFilter($pwd.'/../../../Phing.php', 'PHING');
+ PHPUnit_Util_Filter::addFileToFilter($pwd.'/../../../../phing.php', 'PHING');
}
else
{
require_once 'PHPUnit2/Framework.php';
require_once 'PHPUnit2/Util/Filter.php';
- PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTask.php');
- PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTestRunner.php');
- PHPUnit2_Util_Filter::addFileToFilter('phing/Task.php');
- PHPUnit2_Util_Filter::addFileToFilter('phing/Target.php');
- PHPUnit2_Util_Filter::addFileToFilter('phing/Project.php');
- PHPUnit2_Util_Filter::addFileToFilter('phing/Phing.php');
- PHPUnit2_Util_Filter::addFileToFilter('phing.php');
+ PHPUnit2_Util_Filter::addFileToFilter($pwd.'/PHPUnitTask.php');
+ PHPUnit2_Util_Filter::addFileToFilter($pwd.'/PHPUnitTestRunner.php');
+ PHPUnit2_Util_Filter::addFileToFilter($pwd.'/../../../Task.php', 'PHING');
+ PHPUnit2_Util_Filter::addFileToFilter($pwd.'/../../../Target.php', 'PHING');
+ PHPUnit2_Util_Filter::addFileToFilter($pwd.'/../../../Project.php', 'PHING');
+ PHPUnit2_Util_Filter::addFileToFilter($pwd.'/../../../Phing.php', 'PHING');
+ PHPUnit2_Util_Filter::addFileToFilter($pwd.'/../../../../phing.php', 'PHING');
}
}
Attachments
Change History
comment:2 Changed 3 years ago by hans
- Status changed from closed to reopened
- Resolution fixed deleted
- Milestone changed from 2.3.1 to 2.3.3
comment:4 Changed 3 years ago by hans
- Status changed from reopened to closed
- Resolution set to fixed
comment:5 Changed 3 years ago by fred.alger@…
Hah, good to see this is fixed. Burned half a day today chasing down this problem. One question about the path to the PHPUnit, however -- it will obviously work on Linux systems, but how about on Windows where the path component separator is backwards, i.e. a backslash?
comment:6 Changed 3 years ago by Frederick Alger <fred.alger@…>
Here's how I patched my local PHPUnitTest.php:
--- PHPUnitTask.php 2008-10-21 15:47:04.000000000 -0700
+++ PHPUnitTask.php.patched 2008-10-21 15:47:21.000000000 -0700
@@ -101,6 +101,13 @@
require_once 'phing/tasks/ext/phpunit/BatchTest.php';
require_once 'phing/tasks/ext/phpunit/FormatterElement.php';
+ $fs = FileSystem::getFileSystem();
+ $sep = $fs->getSeparator();
+ $path = dirname(__FILE__) . $sep;
+
+ $phing_path = $path . join($sep, array('..', '..', '..', '..')) . $sep;
+ $phing_classpath = $phing_path . 'phing' . $sep;
+
/**
* Add some defaults to the PHPUnit filter
*/
@@ -114,26 +121,27 @@
define('PHPUnit_MAIN_METHOD', 'PHPUnitTask::undefined');
}
- PHPUnit_Util_Filter::addFileToFilter('PHPUnitTask.php', 'PHING');
- PHPUnit_Util_Filter::addFileToFilter('PHPUnitTestRunner.php', 'PHING');
- PHPUnit_Util_Filter::addFileToFilter('phing/Task.php', 'PHING');
- PHPUnit_Util_Filter::addFileToFilter('phing/Target.php', 'PHING');
- PHPUnit_Util_Filter::addFileToFilter('phing/Project.php', 'PHING');
- PHPUnit_Util_Filter::addFileToFilter('phing/Phing.php', 'PHING');
- PHPUnit_Util_Filter::addFileToFilter('phing.php', 'PHING');
+
+ PHPUnit_Util_Filter::addFileToFilter($path.'PHPUnitTask.php', 'PHING');
+ PHPUnit_Util_Filter::addFileToFilter($path.'PHPUnitTestRunner.php', 'PHING');
+ PHPUnit_Util_Filter::addFileToFilter($phing_classpath.'Task.php', 'PHING');
+ PHPUnit_Util_Filter::addFileToFilter($phing_classpath, 'Target.php', 'PHING');
+ PHPUnit_Util_Filter::addFileToFilter($phing_classpath, 'Project.php', 'PHING');
+ PHPUnit_Util_Filter::addFileToFilter($phing_classpath, 'Phing.php', 'PHING');
+ PHPUnit_Util_Filter::addFileToFilter($phing_path.'phing.php', 'PHING');
}
else
{
require_once 'PHPUnit2/Framework.php';
require_once 'PHPUnit2/Util/Filter.php';
- PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTask.php');
- PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTestRunner.php');
- PHPUnit2_Util_Filter::addFileToFilter('phing/Task.php');
- PHPUnit2_Util_Filter::addFileToFilter('phing/Target.php');
- PHPUnit2_Util_Filter::addFileToFilter('phing/Project.php');
- PHPUnit2_Util_Filter::addFileToFilter('phing/Phing.php');
- PHPUnit2_Util_Filter::addFileToFilter('phing.php');
+ PHPUnit2_Util_Filter::addFileToFilter($path.'PHPUnitTask.php');
+ PHPUnit2_Util_Filter::addFileToFilter($path.'PHPUnitTestRunner.php');
+ PHPUnit2_Util_Filter::addFileToFilter($phing_classpath.'Task.php');
+ PHPUnit2_Util_Filter::addFileToFilter($phing_classpath.'Target.php');
+ PHPUnit2_Util_Filter::addFileToFilter($phing_classpath.'Project.php');
+ PHPUnit2_Util_Filter::addFileToFilter($phing_classpath.'Phing.php');
+ PHPUnit2_Util_Filter::addFileToFilter($phing_path.'phing.php');
}
}
comment:7 Changed 3 years ago by hans
- Status changed from closed to reopened
- Resolution fixed deleted
According to Edward on list,this is still an issue.
comment:8 Changed 3 years ago by urkle
It looks like mrook applied a corrective fix to the branches (r427) (that for some reason wasn't showing up in the trac view of SVN 2 weeks ago) that looks like it'll fix it.. The only thing I noticed is that the main "phing.php" class was removed from the list of filtered files. Was this intentional? or an "oops"?
comment:9 Changed 3 years ago by mrook
- Status changed from reopened to closed
- Resolution set to fixed
This was intentional, the main class 'Phing.php' is still included. Closing this ticket, as it appears to be -finally- fixed.
comment:10 Changed 3 years ago by hans
Excellent -- I'll roll 2.3.3 with this fix. Thanks, Michiel.
comment:11 Changed 2 years ago by mrook
- Cc phingbug@… added
- Status changed from closed to reopened
- Resolution fixed deleted
According to phingbug@…:
This is still happening with the latest Phing + PHPUnit, both installed from via PEAR.
Output:
Buildfile: /home/simon/build/build.xml
[property] Loading /home/simon/build/build.properties
BUILD FAILED Error reading project file [wrapped: PHPUnitTask.php does not exist] Total time: 1.0101 second
comment:13 Changed 2 years ago by mrook
I can't reproduce this using PEAR 1.8.1, PHPUnit 3.3.17 and Phing 2.3.3 (installed from PEAR package). Do you have more information and possibly a build file that can help me reproduce it?
comment:15 Changed 2 years ago by mrook
- Status changed from reopened to closed
- Resolution set to fixed
Most likely fixed in r546 - if this is still an issue for you, please reopen the ticket.

This bug has been fixed in the SVN tree, revision r393.
Thank you for the report, and for helping us make Phing better!