Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phpunit and yii - (PHPUnit/Autoload.php): failed to open stream:

Tags:

php

phpunit

yii

Having a lot of problems installing phpunit with Yii. I run:

$ phpunit unit/dbTest.php

But it turns out this error:

PHP Warning: require_once(PHPUnit/Autoload.php): failed to open stream: No such file or directory in /opt/yii-1.1.10.r3566/framework/test/CTestCase.php on line 12

(include_path='.:/usr/bin:/usr/share/php:/usr/bin/pear:/usr/share/php/Zend/:/opt/php5.3.10/lib/php/PHPUnit'

Some details about my installation:

$ phpunit --version
PHPUnit 3.4.5 by Sebastian Bergmann.

php --version
PHP 5.3.10 (cli) (built: Apr  6 2012 20:06:37) ( rebuilt didn't help :( )

pear list phpunit/phpunit
....
php    /opt/php5.3.10/lib/php/PHPUnit/Autoload.php

According to that info, autoload is installed, and is on the include path.

I'm unsure what else I need to do - can anyone shed a light please?

like image 885
rix Avatar asked Aug 04 '26 06:08

rix


1 Answers

I hope this is of some use to someone:

It seems on ubuntu PEAR is broken for this task and apt-get won't help either.

This is how i solved it

Manually download from http://pear.phpunit.de/

phpunit/PHPUnit

and

phpunit/File_Iterator
PHPUnit_MockObject
phpunit/PHPUnit_Selenium
PHP_CodeCoverage

Manually dezip and put correctly in php lib or wherever you want them to go. Put the head of this library on your include path (PHP, PHPlib, PEAR are all at this root level on my setup.)

Goddam, hope that helps someone i spent about 6 hours getting this to work last nite...

like image 121
rix Avatar answered Aug 05 '26 20:08

rix