Phpunit and yii - (PHPUnit / Autoload.php): Failed to open stream:

You have a lot of problems installing phpunit with Yii. I launched:

$ phpunit unit/dbTest.php

      

But this error turns out:

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 / Library / PHP / PHPUnit

Some details about my setup:

$ 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 this information, autoload is installed and is on the way to enable.

I'm not sure what else I need to do - can anyone shed some light?

+3


source to share


2 answers


I hope this is helpful to someone:

Ubuntu PEAR seems to be broken for this task, and apt-get

won't help either.

This is how I solved it

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

phpunit/PHPUnit

      



and

phpunit/File_Iterator
PHPUnit_MockObject
phpunit/PHPUnit_Selenium
PHP_CodeCoverage

      

Manually decompose and place correctly in the php lib or wherever you want. Place the head of this library on your include path (PHP, PHPlib, PEAR are at this root level in my setup.)

God, I hope someone I spent about 6 hours made this work on the last end ...

+3


source


As rix shows in his answer, you have to download multiple files manually.

I was working on Ubuntu 10.04 following the following commands:

wget http://pear.phpunit.de/get/PHPUnit-3.6.10.tgz
wget http://pear.phpunit.de/get/File_Iterator-1.3.1.tgz
wget http://pear.phpunit.de/get/PHPUnit_MockObject-1.1.1.tgz
wget http://pear.phpunit.de/get/PHPUnit_Selenium-1.2.6.tgz
wget http://pear.phpunit.de/get/PHP_CodeCoverage-1.1.2.tgz
wget http://pear.phpunit.de/get/PHP_TokenStream-1.1.3.tgz
wget http://pear.phpunit.de/get/Text_Template-1.1.1.tgz
wget http://pear.phpunit.de/get/PHP_Timer-1.0.2.tgz

sudo vi /etc/php5/cli/php.ini

      



=> add / usr / share / php / PHPUnit / to include_path directive

tar xzf PHPUnit-3.6.10.tgz 
cd PHPUnit-3.6.10/
sudo cp -r PHPUnit/ /usr/share/php/
sudo ln -s /usr/share/php/PHPUnit /usr/bin/PHPUnit

tar xzf File_Iterator-1.3.1.tgz
sudo cp -r File/ /usr/share/php/PHPUnit/

tar xzf PHP_CodeCoverage-1.1.2.tgz
cd PHP_CodeCoverage-1.1.2/
sudo cp -R PHP/ /usr/share/php/PHPUnit/

tar xzf PHP_TokenStream-1.1.3.tgz
cd PHP_TokenStream-1.1.3/PHP/
sudo cp -r Token* /usr/share/php/PHPUnit/PHP/

tar xzf Text_Template-1.1.1.tgz
cd Text_Template-1.1.1/
sudo cp -r Text/ /usr/share/php/PHPUnit/

tar xzf PHP_Timer-1.0.2.tgz 
cd PHP_Timer-1.0.2/
sudo cp -r PHP/Timer* /usr/share/php/PHPUnit/PHP/

tar xzf PHPUnit_MockObject-1.1.1.tgz
cd PHPUnit_MockObject-1.1.1/
sudo cp -r PHPUnit/Framework/MockObject/ /usr/share/php/PHPUnit/Framework/

tar xzf PHPUnit_Selenium-1.2.6.tgz
cd PHPUnit_Selenium-1.2.6/
sudo cp -r PHPUnit/Extensions/* /usr/share/php/PHPUnit/Extensions/

      

+2


source







All Articles