2

i'm trying to use phpunit in yii

i followed the instruction to install it from http://phpunit.de/manual/4.1/en/installation.html

when i'm doing this

phpunit protected/tests/unit/

this error happend

PHP Warning:  require_once(PHPUnit/Extensions/SeleniumTestCase.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/news/framework/test/CWebTestCase.php on line 12

when i'm trying to install SeleniumTestCase again throw

composer global require "phpunit/phpunit-selenium": ">=1.2"

this is what appeared

Changed current directory to /home/qts1234/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev) 
Nothing to install or update 
Generating autoload files 

what can i do . please help

Hossam Aldeen Ahmed
  • 772
  • 1
  • 8
  • 20

1 Answers1

1

Installing the selenium scripts globally with composer does not add them to your include path nor will it be seen by the autoloader.

You should instead add phpunit/phpunit-selenium as a development dependency and have composer install it into your project so your bootstrap can load the autoloader and the tests you are extending will be found.

Steve Buzonas
  • 5,300
  • 1
  • 33
  • 55
  • I did as said, installed it and the other dependencies(Invoker, DBunit etc ) through composer and the files are on vendor folder as expected, but I keep getting this exactly error. Any other suggestion? I'm in yii 1.1. – Shad Dec 12 '15 at 17:10
  • @Shad are you including the autoloader in your phpunit bootstrap script? – Steve Buzonas Dec 15 '15 at 18:18
  • http://saa.dfarooq.com/blog/2014/01/10/phpunit-with-yii-and-composer/ lists some of the missing components. – hafichuk Mar 18 '16 at 20:25