Bug 1157910

Summary: System PHPUnit broken in composer projects which requires phpunit
Product: [Fedora] Fedora Reporter: Shawn Iwinski <shawn>
Component: php-phpunit-PHPUnitAssignee: Remi Collet <fedora>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fedora, rcollet, shawn
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: php-phpunit-PHPUnit-4.6.10-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-18 13:18:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Shawn Iwinski 2014-10-28 02:45:15 UTC
Description of problem:
PHPUnit "--list-groups" fails


Version-Release number of selected component (if applicable):
php-phpunit-PHPUnit-3.7.34-1.fc20.noarch


How reproducible:
Run "phpunit --list-groups"


Steps to Reproduce:
1. Change into an already setup PHP project directory (i.e. "phpunit" itself runs fine)
2. Run "phpunit --list-groups"


Actual results:
PHP Fatal error:  Call to undefined method PHPUnit_TextUI_TestRunner::printVersionString() in /usr/share/pear/PHPUnit/TextUI/Command.php on line 154
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP   3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:129


Expected results:
A list of PHPUnit groups


Additional info:
Runs fine when using a composer-installed phpunit.

Comment 1 Remi Collet 2014-10-28 06:33:02 UTC
This seems to happen in a composer project, where PHPUnit is also installed.

In this case you have to use vendor/bin/phpunit

As "vendor/autoload.php" have priority on PHPUnit autoloader, I don't think we can fix this bug.

Comment 2 Remi Collet 2014-11-04 09:18:58 UTC
Can you please confirm if this anser is ok for you; so I can close this bug as "CANTFIX" ?

Comment 3 Shawn Iwinski 2014-11-04 17:17:37 UTC
(In reply to Remi Collet from comment #1)
> This seems to happen in a composer project, where PHPUnit is also installed.
> 
> In this case you have to use vendor/bin/phpunit
> 
> As "vendor/autoload.php" have priority on PHPUnit autoloader, I don't think
> we can fix this bug.

(In reply to Remi Collet from comment #2)
> Can you please confirm if this anser is ok for you; so I can close this bug
> as "CANTFIX" ?

Sorry, yeah, it's only when a composer project "require-dev"s phpunit.  Yes, I'm OK for you to close this as won't fix.

Comment 4 Remi Collet 2015-05-26 06:47:19 UTC
I reopen this bug as it seems the issue raise again.
See: https://github.com/sebastianbergmann/phpunit/issues/1724

I plan to add a check in the launcher and switch to composer installed version if detected.

Ex: from gitter clone

Without se fix

    $ phpunit
    PHPUnit 4.1.0 by Sebastian Bergmann.

    Configuration read from /work/GIT/gitter/phpunit.xml.dist

    .
    Fatal error: Call to undefined method Gitter\Tests\ClientTest::hasExpectationOnOutput() in /usr/share/php/PHPUnit/TextUI/ResultPrinter.php on line 511


With the fix

    $ phpunit

    ==== Redirecting to composer installed version in vendor/phpunit ====

    PHPUnit 4.1.0 by Sebastian Bergmann.

    Configuration read from /work/GIT/gitter/phpunit.xml.dist

    ................................................

    Time: 690 ms, Memory: 9.75Mb

    OK (48 tests, 284 assertions)

Comment 5 Fedora Update System 2015-05-26 07:41:55 UTC
php-phpunit-PHPUnit-4.6.7-2.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/php-phpunit-PHPUnit-4.6.7-2.fc22

Comment 6 Fedora Update System 2015-05-26 07:42:03 UTC
php-phpunit-PHPUnit-4.6.7-2.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/php-phpunit-PHPUnit-4.6.7-2.fc21

Comment 7 Fedora Update System 2015-05-26 07:42:10 UTC
php-phpunit-PHPUnit-4.6.7-2.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/php-phpunit-PHPUnit-4.6.7-2.el7

Comment 8 Fedora Update System 2015-05-26 21:25:59 UTC
Package php-phpunit-PHPUnit-4.6.7-2.el7:
* should fix your issue,
* was pushed to the Fedora EPEL 7 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing php-phpunit-PHPUnit-4.6.7-2.el7'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2015-6396/php-phpunit-PHPUnit-4.6.7-2.el7
then log in and leave karma (feedback).

Comment 9 Fedora Update System 2015-06-18 13:18:20 UTC
php-phpunit-PHPUnit-4.6.10-1.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2015-06-18 13:20:07 UTC
php-phpunit-PHPUnit-4.6.10-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2015-06-20 21:15:31 UTC
php-phpunit-PHPUnit-4.6.10-1.el7 has been pushed to the Fedora EPEL 7 stable repository.  If problems still persist, please make note of it in this bug report.