search
Homephp教程php手册PHP Notice: Please no longer include解决办法

PHP Notice: Please no longer include解决办法

Jun 13, 2016 am 10:44 AM
frameworkincludenoticephpyiiMethodexiststudysolve

今天在学习Yii Framework中单元测试时,总是在运行“phpunit unit/DBTest.php”命令的时候出现以下错误,


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

但自己是按照文档上说的安装了PHPUnit包了呀,后来发现想起来安装过程中由于家里网络问题其中一个依赖包出错了,但是别的包都提示安装成功了,然后自己是把那个失败的包PHP_CodeCoverage重新安装的,然后运行unit的时候就出现了上面的错误,于是自己慢慢摸索,然后做了以下步骤后,问题总算被解决了。

1. 打开pear的auto_discover选项

view plaincopy to clipboardprint?$ sudo pear config-set auto_discover 1 
$ sudo pear config-set auto_discover 12. 检查已经安装的phpunit和其依赖包

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. 卸载所有pear.phpunit.de channel下安装的和phpunit相关的包,这里有先后顺序,卸载的时候会有提示

view plaincopy to clipboardprint?$ sudo pear uninstall PHPUnit 
$ sudo pear uninstall PHPUnit_MockObject 
... 
$ sudo pear uninstall PHPUnit
$ sudo pear uninstall PHPUnit_MockObject
...4. 重新安装PHPUnit包

view plaincopy to clipboardprint?$ sudo pear install pear.phpunit.de/PHPUnit 
$ sudo pear install pear.phpunit.de/PHPUnit5. 再次运行“phpunit unit/DBTest.php”,问题解决。

作者“kongxx的专栏”
 

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools