PHPUnit extension warning in Yii

I am setting up unit testing to work with the Yii framework. Besides Yii, my PHPUnit works fine. But along with Yii, when I try to check it, he gives me the following warning every time.

Warning: include(PHPUnit_Extensions_Story_TestCase.php): failed to open stream: No such file or directory in D:\xampp\htdocs\yii1112\framework\YiiBase.php on li ne 423 Warning: include(): Failed opening 'PHPUnit_Extensions_Story_TestCase.php' for i nclusion (include_path='.;D:\xampp\htdocs\sms_dev\protected\extensions\yii-mail; D:\xampp\htdocs\sms_dev\protected\extensions\giix-components;D:\xampp\htdocs\sms _dev\protected\components;D:\xampp\htdocs\sms_dev\protected\models;D:\xampp\php\ PEAR') in D:\xampp\htdocs\yii1112\framework\YiiBase.php on line 423 

I searched a lot and also asked on the Yii forum, but nothing works.

Does anyone know what this warning means? How can I get rid of it?

+4
source share
3 answers

The PHPUnit_Extensions_Story_TestCase.php file is part of the PHPUnit_Story package, which can be installed using

 pear install phpunit/PHPUnit_Story 

See also: PHPUnit cannot find PHPUnit_Extensions_Story_TestCase. Which package is missing?

+4
source

The protected / tests directory is not included in your include path. I would suggest moving the protected directory from any public location and just adding the protected folder to the include path. therefore d:\xampp\htdocs\sms_dev\protected\ instead of listing each directory separately.

Either this is a problem, or the file does not exist, and you should check your code.

0
source

With pear installation dependencies [ Now pear packages are not updated better, install with composer )

 sudo pear channel-discover pear.phpunit.de sudo pear install phpunit/PHPUnit_Story sudo pear install phpunit/PHP_Selenium 

It is better if you install phpunit with a composer, these errors will not appear

step 1: Create a composer.json file in the root of your project:

 { "require-dev": { "phpunit/phpunit": "4.6.*", "phpunit/phpunit-selenium": ">=1.4", "phpunit/dbunit": ">=1.3", "phpunit/phpunit-story": "*", "phpunit/php-invoker": "*" }, "autoload": { "psr-0": {"": "src"} }, "config": { "bin-dir": "bin/" } } 

step 2: Install the composer in your project using:

 curl -sS https://getcomposer.org/installer | php 

Ensure composer execution:

 chmod +x composer.phar 

Let the composer establish the dependencies:

 ./composer.phar install --dev 

Make sure you have the version for the specific phpunit project installed:

 bin/phpunit --version 

the above is a soft link

 ls -la bin/phpunit bin/phpunit -> ../vendor/phpunit/phpunit/phpunit 

Afterword you can make softlink from "phpunit" from the vendor directory to the directory used by php. This will clear all warnings related to

 PHP Warning: include(classes/PHPUnit_Extensions_Story_TestCase.php) PHP Warning: include(): Failed opening 'classes/PHPUnit_Extensions_Story_TestCase.php' PHP Warning: include(classes/Composer\Autoload\ClassLoader.php) 
0
source

All Articles