2012-02-25 6 views
1

をスローOKです:PHPUnitの3.6.10 +のNetBeans 7.1:良いテストがCMDLINEすべてが例外

NetBeans7.1に呼び出され
d:\xampp\htdocs\PhpProject1\Tests>phpunit TestStub.php 
PHPUnit 3.6.10 by Sebastian Bergmann. 

. 

Time: 0 seconds, Memory: 2.75Mb 

OK (1 test, 1 assertion) 

Fatal error: Uncaught exception 'PHPUnit_Framework_Exception' with message 'Could not find class "" in "D:\Program Files (x86)\NetBeans 7.1\php\phpunit\NetBeansSuite.php".' in D:\xampp\php\PEAR\PHPUnit\Util\Skeleton\Test.php:123 
Stack trace: 
0 D:\xampp\php\PEAR\PHPUnit\TextUI\Command.php(157): PHPUnit_Util_Skeleton_Test->__construct('', 'D:\Program File...') 
1 D:\xampp\php\PEAR\PHPUnit\TextUI\Command.php(130): PHPUnit_TextUI_Command->run(Array, true) 
2 D:\xampp\php\phpunit(46): PHPUnit_TextUI_Command::main() 
3 {main} 
thrown in D:\xampp\php\PEAR\PHPUnit\Util\Skeleton\Test.php on line 123 

私は、これは、NetBeansの問題だと思います。私が実行した場合 :

d:\Program Files (x86)\NetBeans 7.1\php\phpunit>phpunit NetBeansSuite.php run=d:\xampp\htdocs\PhpProject1\Tests\TestStub.php 
PHPUnit 3.6.10 by Sebastian Bergmann. 

. 

Time: 0 seconds, Memory: 2.75Mb 

OK (1 test, 1 assertion) 

それはOKです。しかし、私がテストディレクトリを与えると失敗します。

d:\Program Files (x86)\NetBeans 7.1\php\phpunit>phpunit NetBeansSuite.php run=d:\xampp\htdocs\PhpProject1\Tests\ 

Fatal error: Uncaught exception 'PHPUnit_Framework_Exception' with message 'Could not find class "" in "D:\Program Files (x86)\NetBeans 7.1\php\phpunit\NetBea 
nsSuite.php".' in D:\xampp\php\PEAR\PHPUnit\Util\Skeleton\Test.php:123 
Stack trace: 
0 D:\xampp\php\PEAR\PHPUnit\TextUI\Command.php(157): PHPUnit_Util_Skeleton_Test->__construct('', 'D:\Program File...') 
1 D:\xampp\php\PEAR\PHPUnit\TextUI\Command.php(130): PHPUnit_TextUI_Command->run(Array, true) 
2 D:\xampp\php\phpunit(46): PHPUnit_TextUI_Command::main() 
3 {main} 
thrown in D:\xampp\php\PEAR\PHPUnit\Util\Skeleton\Test.php on line 123 

一時的な解決策はありますか?

+0

「d:¥Program Files(x86)¥NetBeans 7.1¥php¥phpunit¥NetBeansSuite.php」の行118は、解答 を示しています。return self :: rglob( "* [Tt] est.php" 、$ run.DIRECTORY_SEPARATOR); テストファイル名を終了する必要があります... Test.php – shuttle

+1

NetBeansを 'bootstrap.php'ファイルや/または' phpunit.xml'ファイルにポイントしましたか? –

+0

私は個人的に、NetBeansのPHPUnitのサポートには問題があり、代わりにコマンドラインで単体テストを実行することを躊躇しています。 – Hades

答えて

3

PHPUnitを1つのファイルに対して実行する場合、常にファイルを開き、その中にテストケースを探します。

(これはnetbeansと同じ)ディレクトリに対して実行すると、*Test.phpで終わるファイルだけが検索されます(phpunit.xmlに何かが指定されていない限り)。

それはどんなテストを見つけることができない場合、それは$TestSuiteNameフォルダと{$TestSuiteName}.phpファイルので、エラーメッセージに見えるようにしようとします:それは内「と名付けられていない」テストスイートを探しているよう

Fatal error: Uncaught exception 'PHPUnit_Framework_Exception' with message 'Could not find class ""

netbeans phpunitハーネス。エラーメッセージは実際にあなたを助けてくれません:)

一般的な提案はphpunit.xmlを作成し、Netbeansをポイントすることです。

重要なIDEのphpunitサポートから、Netbeansは多くの人に正しく機能し、うまく動作するので、このバンプはIDEからの使用を妨げません。それはあなたが望むものです。

関連する問題