PHP Notice: Please no longer include "PHPUnit/Framework.php". 解決辦法____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選項

$ sudo pear config-set auto_discover 1
2. 檢查已經安裝的phpunit和其依賴包

$ sudo pear list -aInstalled packages, channel pear.phpunit.de:============================================Package            Version StateDbUnit             1.0.3   stableFile_Iterator      1.2.6   stablePHPUnit            3.5.15  stablePHPUnit_MockObject 1.0.9   stablePHPUnit_Selenium   1.0.3   stablePHP_CodeCoverage   1.0.5   stablePHP_Timer          1.0.2   stablePHP_TokenStream    1.0.1   stableText_Template      1.1.0   stable
3. 卸載所有pear.phpunit.de channel下安裝的和phpunit相關的包,這裡有先後順序,卸載的時候會有提示

$ sudo pear uninstall PHPUnit$ sudo pear uninstall PHPUnit_MockObject...
4. 重新安裝PHPUnit包

$ sudo pear install pear.phpunit.de/PHPUnit
5. 再次運行“phpunit unit/DBTest.php”,問題解決。




相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.