Edit report at https://pear.php.net/bugs/bug.php?id=20053&edit=1
ID: 20053
Updated by: [email protected]
Reported By: ffrey dot [email protected]
Summary: phpunit tests fail with phpunit 3.7 (phar)
Status: Feedback
Type: Documentation Problem
Package: PHP_CodeSniffer
Operating System: windows 8
Package Version: 1.5.0RC3
PHP Version: 5.3.27
Assigned To: squiz
Roadmap Versions:
New Comment:
Ah ok, that makes sense now. Yes, the PEAR installer downloads the files
and puts
them in a central location.
I'll see what I can do about those requires to make it work with both
methods.
Previous Comments:
------------------------------------------------------------------------
[2013-08-26 10:44:27] ffrey
-Summary: phpunit tests fail with phpunit 3.7
+Summary: phpunit tests fail with phpunit 3.7 (phar)
I use the "phar archive" of phpunit (presented as "easiest way" to
install
http://phpunit.de/manual/current/en/installation.html).
All classes are included within the phar, hence the collusion with the
requires &
includes within the test, i presume.
I suppose the pear install downloads phpunit files as separate files ?
------------------------------------------------------------------------
[2013-08-26 05:34:28] squiz
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: squiz
I don't think this has anything to do with the PHPUnit version. Your
version works
fine for me:
72:tests gsherwood$ phpunit PHP_CodeSniffer/AllTests.php
PHPUnit 3.7.24 by Sebastian Bergmann.
............................................................... 63 /
211 ( 29%)
............................................................... 126 /
211 ( 59%)
...........................SS.................................. 189 /
211 ( 89%)
......................
Time: 2.8 seconds, Memory: 45.00Mb
OK, but incomplete or skipped tests!
Tests: 211, Assertions: 54, Skipped: 2.
So I'd need to find out what is different about your install. I have
PHPUnit installed
via PEAR, so all the require_once statements should end up trying to
require the
PEAR installed code. In this case, PHP would obviously only include the
file one, and
so you wont get a duplicate class name. In your case, the require_once
call must
be pointing to a different install.
Do you have phpunit installed in multiple locations or by multiple
methods? Is your
php include_path set correctly for the one you want to use? I'm not sure
what else
might be wrong.
------------------------------------------------------------------------
[2013-08-23 13:05:46] ffrey
Description:
------------
Unit testing with phpunit 3.7 fails.
This is due to the presence of "^require_once 'PHPUnit.+" in 19
files of the test suite.
Deletion of those requires solves the problem.
Test script:
---------------
phpunit
C:\Users\...\php_libs\pear\tests\PHP_CodeSniffer.1-5\AllTests.php
Expected result:
----------------
PHPUnit 3.7.24 by Sebastian Bergmann.
.................
Time: 1.83 seconds, Memory: 6.00Mb
OK (17 tests, 54 assertions)
Actual result:
--------------
Fatal error: Cannot redeclare class PHPUnit_TextUI_TestRunner
------------------------------------------------------------------------