2012-04-11 71 views
2

當我創建通過Zend_Tool 命令如下控制器:PHPUnit的3.6.10 + ZendFramework 1.11.11 + 7.1的NetBeans

create controller NameController

... NetBeans的成功創建了一個新的控制器。但是,它在輸出窗口發送消息:

PHPUnit is required in order to generate controller test stubs.

如何讓NetBeans中自動創建PHPUnit的測試類?我搜索網,成千上萬的解決方案至今沒有能夠解決......

重要提示:

  • 在已經安裝了梨
  • 已經安裝PHPUnit的
  • 已經列入「PHPUnit的」 include_path
  • 已創建一個文件,並在include_path中也包含zf.ini
  • 選項已配置netbeans,其中我通知了phpunit.bat目錄。

這是NetBeans中的錯誤嗎?

參見:

http://img545.imageshack.us/img545/262/001hxw.jpg

http://img855.imageshack.us/img855/8918/002jfy.jpg

http://img196.imageshack.us/img196/378/003sfu.jpg http://img196.imageshack.us/img196/378/003sfu.jpg

http://img834.imageshack.us/img834/1858/004qc.jpg http://img834.imageshack.us/img834/1858/004qc.jpg

http://img444.imageshack.us/img444/1020/005jx.jpg http://img444.imageshack.us/img444/1020/005jx.jpg

+0

以及我正要問同樣的問題:) – Songo 2012-04-11 18:32:22

+0

zend Framework 1與phpUnit 3.6不兼容,您必須降級到3.5 http://dustyreagan.com/downgrade-phpunit-3-6- to-3-5-15/ – max4ever 2012-07-24 09:18:41

+0

@ max4ever ZF 1.11.11與phpUnit 3.6.10兼容。我在這裏做了一個測試,它工作。 – Vegetus 2012-07-25 13:18:39

回答

0

我找到了解決辦法。

C:/用戶/您的個人資料的用戶/ .zf.ini,配置文件是這樣的:

php.include_path = ".C:/wamp/bin/php/php5.3.8/pear/PHPUnit;C:/Program Files/NetBeans 7.1/php/zend;C:/wamp/apps/ZendFramework/library" basicloader.classes.0 = "NetBeansCommandsProvider"

我接過php.include_path,離開文件,如下:

basicloader.classes.0 = "NetBeansCommandsProvider"

嗯..這是瘋狂和不理解,因爲它的工作很適合我。

注意:請注意,在C:\ wamp \ bin \ php \ php5.3.8和C:\ wamp \ bin \ apache \ Apache2.2.21 \ bin中的php.ini文件中應該已經設置了include_path

謝謝大家!

1

我不認爲這是一個Neatbeans問題,因爲它是一個Zend_Tool(zf.bat)的問題。
在phpunit正確安裝之前,您可能正在使用由Zend_Tool構建的項目。
在這種情況下,部分或您的.zfproject.xml沒有使用phpunit所需的信息。
Netbeans實際上並沒有與Zend_Tool做任何事情,然後提供一個圖形界面。
我希望我對此問題有一個快速解決方案,但我沒有。我在過去的解決了這個:

  1. 確保PHPUnit的正確設置和Netbeans

現在的工作,你有兩個選擇:

  1. 與重拍的項目目錄Zend_Tool並讓.zf項目。XML文件與工作PHPUnit的產生。(這與新的項目運作良好)

  2. 建立一個新的項目,Zend_Tool,看.zfproject.xml與編輯和更改.zfproject.xml爲您的項目包括phpunit信息。此方法可能需要一些試驗和錯誤才能得到正確。

是完整這裏是我的.zfproject.xml文件的一個摘錄:

<testsDirectory> 
     <testPHPUnitConfigFile filesystemName="phpunit.xml"/> 
     <testPHPUnitBootstrapFile filesystemName="bootstrap.php"/> 
     <testApplicationDirectory> 
     <testApplicationControllerDirectory> 
      <testApplicationControllerFile forControllerName="Index"/> 
     </testApplicationControllerDirectory> 
     </testApplicationDirectory> 
     <testLibraryDirectory/> 
    </testsDirectory> 

我還沒有找到一種方法來重新生成.zfproject.xml文件以反映環境的變化。

我希望有另外一個更容易修復...

+0

@Rockford , 感謝您的回覆。但是,您的'xml'中的代碼在我的_zfproject.xml_上得到了補充,因爲我已經設置了項目屬性(請參閱我的問題中的圖4)。我遵循你的程序,但沒有爲我工作。但是現在,我設法只生成了一個PHPUnit測試控制器:**在'zf.ini' **中刪除'php.include_path'。真是愚蠢! – Vegetus 2012-04-12 13:19:04

+0

我甚至不知道zf.ini的存在,謝謝你的回答。 – RockyFord 2012-04-13 06:37:26