PHP Notice: Please no longer include解決辦法_PHP教程

來源:互聯網
上載者:User
今天在學習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的專欄”

http://www.bkjia.com/PHPjc/478648.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478648.htmlTechArticle今天在學習Yii Framework中單元測試時,總是在運行phpunit unit/DBTest.php命令的時候出現以下錯誤, PHP Notice: Please no longer include PHPUnit/Framework.p...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.