phpunit requires PHP_CodeCoverage

Bug #701544 reported by Alexander Shwets
312
This bug affects 66 people
Affects Status Importance Assigned to Milestone
pear-phpunit-channel (Ubuntu)
Invalid
Undecided
Unassigned
Precise
Won't Fix
Undecided
Unassigned
php-codecoverage (Ubuntu)
Fix Released
Undecided
Unassigned
Precise
Won't Fix
Medium
Micah Gersten
php-file-iterator (Ubuntu)
Invalid
Undecided
Unassigned
Precise
Won't Fix
Undecided
Unassigned
php-text-template (Ubuntu)
Invalid
Undecided
Unassigned
Precise
Won't Fix
Undecided
Unassigned
php-token-stream (Ubuntu)
Invalid
Undecided
Unassigned
Precise
Won't Fix
Undecided
Unassigned
phpunit (Debian)
Fix Released
Unknown
phpunit (Ubuntu)
Fix Released
High
Unassigned
Precise
Won't Fix
Medium
Micah Gersten

Bug Description

Binary package hint: phpunit

PHPUnit requires PHP_CodeCoverage, but there is no one in this or other deb package.

So, we have error until install PHP_CodeCoverage from PEAR:
PHP Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='.:/usr/share/php:/usr/share/pear') in /usr/bin/phpunit on line 38

phpunit (3.5.5-2)

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Thanks for reporting this bug and making Ubuntu better!

I got the same error when running phpunit on Natty.

Changed in phpunit (Ubuntu):
status: New → Confirmed
Changed in phpunit (Debian):
status: Unknown → New
Revision history for this message
Gonzalo Cao (gonzalo-cao) wrote :

Same problem detected. Phpunit has been working in 10.10 until migration to 11.04 beta. Now I get this error:

xxxx@xxxx:~$ phpunit
PHP Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 38
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='.:/usr/share/php:/usr/share/pear') in /usr/bin/phpunit on line 38
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0

Revision history for this message
David JM Emmett (davidjmemmett) wrote :

Has anything happened with this issue since February?

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

David: Have you taken a look at the Debian bug? It links to another bug report discussing packaging PHP CodeCoverage.

Revision history for this message
Ricardo Coelho (ram-coelho) wrote :

I know this won't solve the issue, but maybe someone hit this page looking for a workaround. Try this:

sudo apt-get remove phpunit
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
sudo pear update-channels
sudo pear upgrade-all
sudo pear install --alldeps phpunit/PHPUnit

Revision history for this message
Tharakan (tharakan) wrote :

I confirm that the steps provided by Ricardo (on 2011-05-13) are working fine for Ubuntu 11.04. Just that you would need to install phpunit using apt-get in the end, once again.

For convenience, the steps again below:

sudo apt-get remove phpunit
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
sudo pear update-channels
sudo pear upgrade-all
sudo pear install --alldeps phpunit/PHPUnit
sudo apt-get install phpunit

Revision history for this message
spe (jspeshu) wrote :

even though i did ths steps as recommended above, i didn't get it to work but after i upgraded pear from 1.9.1 to 1.9.2 it's working perfectly just do this

speshu@speshu-laptop:~$ sudo pear upgrade pear

       downloading PEAR-1.9.2.tgz ...
       Starting to download PEAR-1.9.2.tgz (295,120 bytes)
        .....................................................done: 295,120 bytes
        upgrade ok: channel://pear.php.net/PEAR-1.9.2
        PEAR: Optional feature webinstaller available (PEAR's web-based installer)
        PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
        PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
        PEAR: To install optional features use "pear install pear/PEAR#featurename"

Revision history for this message
spe (jspeshu) wrote :

and am using 11.04 ...

Revision history for this message
Steffen H. (shulegaa) wrote :

   On a totally up-to-date Ubuntu 11.04 system, sudo apt-get install phpunit still installs a completely useless phpunit package - as reported about a year ago above. How does this sort of package pass even the most cursory of QA checks? This precedent is a bit disturbing. I imagine I just don't know the story/context. At any rate:

phpunit --verbose
PHP Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 38
PHP Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='.:/usr/share/php:/usr/share/pear') in /usr/bin/phpunit on line 38

    Even following the work-around, there's a non-fatal configuration problem. I'm not sure when/if this will cause any hard-to-diagnose side-effects:

phpunit --verbose .
PHP Notice: Please no longer include "PHPUnit/Framework.php". in /usr/share/php/PHPUnit/Framework.php on line 50
PHPUnit 3.5.5 by Sebastian Bergmann.

    It looks as if PHP is going to require using PEAR more than apt-get. Hmm. This sounds like a slippery slope.

    By the way, I followed the amalgamated work-around contributed above. A *huge* thanks to to posters above:

sudo apt-get remove phpunit
sudo pear upgrade pear
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
sudo pear update-channels
sudo pear upgrade-all
sudo pear install --alldeps phpunit/PHPUnit
sudo apt-get install phpunit

Cheers

Revision history for this message
Cinquero (cinquero) wrote :

have that problem too. First answer at

http://stackoverflow.com/questions/1528717/phpunit-require-once-error

solved it. Also affects Ubuntu 11.04.

Revision history for this message
jphuart (jeanpierrehuart) wrote :

Thanks to everybody for the contributions.
I'm using ubuntu 10.10 64bits and had the same problem.
I applied what proposed by Steffen, but I skipped the last line.
I just want to mention that there is no need to re-install phpunit (sudo apt-get install phpunit) to make it working.

Ciao

Revision history for this message
VolCh (vcher) wrote :

In 11.10 this issue still here

Revision history for this message
Stéphane Gourichon (stephane-gourichon-lpad) wrote :

Here on 11.10 64-bit bug still present.

Solution mentioned on comment #10 (ref. stackoverflow) was not sufficient.

Solution mentioned at end of comment #9 (with uninstall/reinstall phpunit), same as comment #6 worked quickly.

Revision history for this message
Frank Groeneveld (frankgroeneveld) wrote :

Unbelievable. QA is just missing in Ubuntu.

Revision history for this message
John Faucett (jwaterfaucett) wrote :

Still not working:
  Ubuntu 11.10 x86_64 Linux

Here's what I had to do: (same as above just don't run apt-get install - didn't work for me)

sudo apt-get remove phpunit
sudo apt-get upgrade pear
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
sudo pear update-channels
sudo pear upgrade-all
sudo pear install --alldeps phpunit/PHPUnit

then test with:

phpunit --version

if you get the Sebastian Bergmann everything should work fine from there.

followed this guys stuff
http://www.giocc.com/installing-phpunit-on-ubuntu-11-04-natty-narwhal.html

Revision history for this message
Cinquero (cinquero) wrote :

The problem still persists in Ubuntu Precise.

> Unbelievable. QA is just missing in Ubuntu.

That's not only Ubuntu, it is almost the entire open-source realm except where professional products are actively being worked on. Debian should really start to throw out packages without proper (that is automatic and complete) integration tests. Instead, Ubuntu and GNOME people start to work on fancy desktop managers -- stuff which is practically useless. Debian should also start to only accept bug reports in the form of regression tests. And it should reject package upgrades if regression tests cannot be re-used and the new tests are of lower quality....

Changed in phpunit (Debian):
status: New → Fix Released
Revision history for this message
Aleksander Machniak (al3c) wrote :

Still not fixed.

Revision history for this message
PowerKiKi (adrien-crivelli) wrote :

On Ubuntu 12.04, experienced same issue:

$ sudo apt-get install phpunit
$ phpunit
PHP Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 38
[...]

Workaround from John Faucett worked great, on the condition to update symphony url, as follow:

sudo apt-get remove phpunit
sudo apt-get upgrade pear
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony.com
sudo pear channel-discover components.ez.no
sudo pear update-channels
sudo pear upgrade-all
sudo pear install --alldeps phpunit/PHPUnit

Revision history for this message
Tomasz Ducin (tomasz-ducin) wrote :

Confirm @PowerKiKi - the problem is still there. The workaround is really nasty.

Revision history for this message
pearlbear (michelle-murrain) wrote :

Any news on this? Confirmed from here.

Revision history for this message
Stephen Rees-Carter (valorin) wrote :

Is there any point to having phpunit in the Ubuntu repos?

It's a piece of cake to install via Composer or PEAR. Both those two methods will get you the latest version too rather than an out-dated version.

Revision history for this message
Daniel Hahler (blueyed) wrote :

Ubuntu 12.10 (Quantal) now has php-codecoverage.

Changed in phpunit (Ubuntu):
importance: Undecided → High
status: Confirmed → Triaged
Daniel Hahler (blueyed)
Changed in phpunit (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Does that mean bug 755973 can be closed too? Afterall, it was linked to the same Debian bug.

Revision history for this message
Micah Gersten (micahg) wrote :

I think we should try to SRU php-codecoverage to precise and update the dependency since PHPUnit is broke by default without it.

Changed in phpunit (Ubuntu Precise):
assignee: nobody → Micah Gersten (micahg)
importance: Undecided → High
status: New → Triaged
Changed in php-codecoverage (Ubuntu):
status: New → Fix Released
Changed in php-codecoverage (Ubuntu Precise):
status: New → Triaged
importance: Undecided → Medium
Changed in phpunit (Ubuntu Precise):
importance: High → Medium
Changed in php-codecoverage (Ubuntu Precise):
assignee: nobody → Micah Gersten (micahg)
Revision history for this message
Micah Gersten (micahg) wrote :

I'll have to talk to the SRU team as this will require 4 new dependencies (pear-phpunit-channel php-text-template php-file-iterator php-token-stream)

Micah Gersten (micahg)
Changed in pear-phpunit-channel (Ubuntu):
status: New → Invalid
Changed in php-file-iterator (Ubuntu):
status: New → Invalid
Changed in php-text-template (Ubuntu):
status: New → Invalid
Changed in php-token-stream (Ubuntu):
status: New → Invalid
Revision history for this message
LexLythius (lexlythius) wrote :

Any news in this respect?
I believe that until this is fixed in precise (current LTS server version, by the way), we would be better off if you just leave some sort of dummy package with instructions to download the real thing through PEAR. We wouldn't waste time trying to get this one to work in the meantime.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in pear-phpunit-channel (Ubuntu Precise):
status: New → Confirmed
Changed in php-file-iterator (Ubuntu Precise):
status: New → Confirmed
Changed in php-text-template (Ubuntu Precise):
status: New → Confirmed
Changed in php-token-stream (Ubuntu Precise):
status: New → Confirmed
Revision history for this message
Tim Landscheidt (scfc) wrote :

What needs to be done to fix this in Precise? (WMF downstream bug: https://phabricator.wikimedia.org/T52222.)

Revision history for this message
Stephen Rees-Carter (valorin) wrote :

I'd suggest you give up on using the Ubuntu package and simply install it manually. The instructions are very easy to follow: https://phpunit.de/manual/current/en/installation.html

Or switch to using Composer which is basically a Package Manager for PHP: https://phpunit.de/manual/current/en/installation.html#installation.composer

Revision history for this message
Tim Landscheidt (scfc) wrote :

I know that (and feel the pain). I'm interested in what is required to fix this specific bug.

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Tim: Stable Release Updates are described at https://wiki.ubuntu.com/StableReleaseUpdates. In general, a fix in more recent release is applied to an older one, the package is tested and the fix is (hopefully) rolled out.

In this specific case though, comment #24 and #25 mentions this will introduce new dependencies, and I don't know how that is dealt with.

Revision history for this message
Eric Dubé (eric-alex-dube) wrote :

I would just like to add to this thread that I just tried PHPUnit for the first time and this bug pissed me off to no end... that is, until I realized it was a bug. The pear installation has reached the end of its life, so that solution no longer works.

Revision history for this message
Eric Dubé (eric-alex-dube) wrote :

I was wrong; ignore me

Revision history for this message
Steve Langasek (vorlon) wrote :

The Precise Pangolin has reached end of life, so this bug will not be fixed for that release

Changed in phpunit (Ubuntu Precise):
status: Triaged → Won't Fix
Changed in php-codecoverage (Ubuntu Precise):
status: Triaged → Won't Fix
Steve Langasek (vorlon)
Changed in pear-phpunit-channel (Ubuntu Precise):
status: Confirmed → Won't Fix
Changed in php-text-template (Ubuntu Precise):
status: Confirmed → Won't Fix
Changed in php-file-iterator (Ubuntu Precise):
status: Confirmed → Won't Fix
Changed in php-token-stream (Ubuntu Precise):
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.