PHPUnit problem

Discuss general development subjects that are not specific to a particular version like the versioning control system we use or other infrastructure.
User avatar
Erik Frèrejean
Registered User
Posts: 207
Joined: Thu Oct 25, 2007 2:25 pm
Location: surfnet
Contact:

PHPUnit problem

Post by Erik Frèrejean »

I need a little help with PHPUnit, I've got it installed and running but when running phpBB database tests it errors out:

Code: Select all

 [erikfrerejean@ ../gitrepositories/Ascraeus]$ phpunit
PHPUnit 3.5.14 by Sebastian Bergmann.

I............................................................   61 / 1178 (  5%)
.............................................PHP Fatal error:  phpunit_autoload(): Failed opening required '/usr/lib/php/PHPUnit/Extensions/Database/Operation/Exception.php' (include_path='.:/usr/lib/php:/usr/local/PEAR:/php/includes:/usr/lib/php/PHPUnit') in /usr/lib/php/PHPUnit/Autoload.php on line 56

Fatal error: phpunit_autoload(): Failed opening required '/usr/lib/php/PHPUnit/Extensions/Database/Operation/Exception.php' (include_path='.:/usr/lib/php:/usr/local/PEAR:/php/includes:/usr/lib/php/PHPUnit') in /usr/lib/php/PHPUnit/Autoload.php on line 56
I've checked the file and also the include_path in php.ini

Code: Select all

 783 ; UNIX: "/path1:/path2"
 784 include_path = ".:/usr/lib/php:/usr/local/PEAR:/php/includes"
based upon the PHPUnit autoloader this should be correct, does phpBB use PHPUnit with some kind of twist or am I missing something here?
Available on .com
Support Toolkit developer

igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Re: PHPUnit problem

Post by igorw »

I had this problem too, not sure if it is OSX specific. Try re-installing phpunit and dbunit. If that doesn't fix it, try re-installing pear using go-pear.phar.

User avatar
Erik Frèrejean
Registered User
Posts: 207
Joined: Thu Oct 25, 2007 2:25 pm
Location: surfnet
Contact:

Re: PHPUnit problem

Post by Erik Frèrejean »

Thanks for the tip :).
Available on .com
Support Toolkit developer

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: PHPUnit problem

Post by callumacrae »

I'm having trouble now (almost the same error)
callum-mbp:phpbb3 callumacrae$ phpunit
PHPUnit 3.5.15 by Sebastian Bergmann.

............................................................... 63 / 944 ( 6%)
.................................
Fatal error: phpunit_autoload(): Failed opening required '/Users/callumacrae/pear/share/pear/PHPUnit/Extensions/Database/Operation/Exception.php' (include_path='.:/Users/callumacrae/pear/share/pear') in /Users/callumacrae/pear/share/pear/PHPUnit/Autoload.php on line 56
I've reinstalled phpunit and dbunit several times, and also pear. The file mentioned exists and is readable. Any ideas?
Made by developers, for developers!
My blog

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: PHPUnit problem

Post by Oleg »

Readable by the user you use for running tests, or some other user?

Make sure the entire tree leading up to that file is readable.

Can you physically read that file as the user running the tests?

Also, note that phpunit has a bunch of dependencies on other packages. It does not just depend on dbunit (at least officially).

You can try installing and enabling xdebug and getting a stack trace to see what code calls that include, and maybe add some debug prints there.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: PHPUnit problem

Post by callumacrae »

Oleg wrote:Readable by the user you use for running tests, or some other user?
Same account. Also doesn't work when running PHPUnit as sudo (don't shoot me please)
Oleg wrote:Make sure the entire tree leading up to that file is readable.
It is.
Oleg wrote:Can you physically read that file as the user running the tests?
Yes.
Oleg wrote:Also, note that phpunit has a bunch of dependencies on other packages. It does not just depend on dbunit (at least officially).

You can try installing and enabling xdebug and getting a stack trace to see what code calls that include, and maybe add some debug prints there.
I've got xdebug, I just don't know how to use it :-(

~Callum
Made by developers, for developers!
My blog

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: PHPUnit problem

Post by naderman »

This really looks like you are just missing DbUnit because of a botched PHPUnit update. See http://sebastian-bergmann.de/archives/8 ... -Woes.html

So you should run

Code: Select all

pear install -f phpunit/DbUnit
pear install -f phpunit/PHPUnit_MockObject
pear install -f phpunit/PHPUnit_Selenium
And then you should really upgrade your pear.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: PHPUnit problem

Post by callumacrae »

naderman wrote:This really looks like you are just missing DbUnit because of a botched PHPUnit update. See http://sebastian-bergmann.de/archives/8 ... -Woes.html

So you should run

Code: Select all

pear install -f phpunit/DbUnit
pear install -f phpunit/PHPUnit_MockObject
pear install -f phpunit/PHPUnit_Selenium
Surely if that was the case, the file wouldn't exist? Running those commands hasn't fixed it.
naderman wrote:And then you should really upgrade your pear.
I installed pear yesterday using go-pear.phar off their website. What's the latest version? I'm running 1.9.4
Made by developers, for developers!
My blog

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: PHPUnit problem

Post by naderman »

Well that was under the assumption that the forced installs would fix it. Since that wasn't the problem, you're pear version is probably up to date ;-)

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: PHPUnit problem

Post by Oleg »

That really should not happen. phpunit checks for file existence immediately before requiring the file.

You can try:

1. ls -l /Users/callumacrae/pear/share/pear/PHPUnit/Extensions/Database/Operation/Exception.php

2. Replace require_once with include_once on line 56. See what php says about that.

3. Try requiring that file in php code yourself, see what happens.

4. Install a different version of phpunit.

5. Do you have anything like selinux running?

6. Copy all pear files into the current directory (/Users/callumacrae/pear/share/pear/ -> .), without preserving permissions.

For xdebug start here: http://xdebug.org/docs/stack_trace

Post Reply