PHP Notice: Please no longer include solution_PHP tutorial

WBOY
Release: 2016-07-13 17:45:46
Original
887 people have browsed it

When I was learning unit testing in Yii Framework today, the following error always occurred when running the "phpunit unit/DBTest.php" command,


PHP Notice: Please no longer include "PHPUnit/Framework.php". in /usr/share/php/PHPUnit/Framework.php on line 50

But I installed the PHPUnit package according to the documentation. Later I realized that during the installation process, one of the dependent packages had an error due to network problems at home, but the other packages all indicated that the installation was successful. Then I installed the one that failed. I reinstalled the PHP_CodeCoverage package, and then the above error occurred when I ran the unit, so I slowly explored it myself, and after doing the following steps, the problem was finally solved.

1. Turn on pear’s auto_discover option

view plaincopy to clipboardprint?$ sudo pear config-set auto_discover 1
$ sudo pear config-set auto_discover 12. Check the installed phpunit and its dependent packages

view plaincopy to clipboardprint?$ sudo pear list -a
Installed packages, channel pear.phpunit.de:
============================================
Package Version State
DbUnit 1.0.3 stable
File_Iterator 1.2.6 stable
PHPUnit 3.5.15 stable
PHPUnit_MockObject 1.0.9 stable
PHPUnit_Selenium 1.0.3 stable
PHP_CodeCoverage 1.0.5 stable
PHP_Timer 1.0.2 stable
PHP_TokenStream 1.0.1 stable
Text_Template 1.1.0 stable
$ sudo pear list -a
Installed packages, channel pear.phpunit.de:
============================================
Package Version State
DbUnit 1.0.3 stable
File_Iterator 1.2.6 stable
PHPUnit 3.5.15 stable
PHPUnit_MockObject 1.0.9 stable
PHPUnit_Selenium 1.0.3 stable
PHP_CodeCoverage 1.0.5 stable
PHP_Timer 1.0.2 stable
PHP_TokenStream 1.0.1 stable
Text_Template 1.1.0 stable3. Uninstall all phpunit-related packages installed under the pear.phpunit.de channel. There is a sequence here. There will be a prompt when uninstalling

view plaincopy to clipboardprint?$ sudo pear uninstall PHPUnit
$ sudo pear uninstall PHPUnit_MockObject
...
$ sudo pear uninstall PHPUnit
$ sudo pear uninstall PHPUnit_MockObject
...4. Reinstall the PHPUnit package

view plaincopy to clipboardprint?$ sudo pear install pear.phpunit.de/PHPUnit
$ sudo pear install pear.phpunit.de/PHPUnit5. Run "phpunit unit/DBTest.php" again and the problem is solved.

Author "kongxx's column"

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478648.htmlTechArticleWhen I was learning unit testing in Yii Framework today, it always appeared when running the phpunit unit/DBTest.php command. The following error, PHP Notice: Please no longer include PHPUnit/Framework.p...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template