2011-11-06 65 views
2

我有一個抽象類,其中的源代碼如下所示:的NetBeans PHPUnit的測試生成忽略@assert標註

/* 
* @assert (0) == NULL 
*/ 
public static function factory($num) { 
    if ($num==0) 
     return NULL; 

    //do some other stuff 
} 

如果我刪除以前生成的測試文件,並使用「創建PHPUnit測試」,它會創建一個似乎沒有新的單元測試文件所採取的斷言考慮在所有:

/** 
* @covers {className}::{origMethodName} 
* @todo Implement testFactory(). 
*/ 
public function testFactory() { 
    // Remove the following lines when you implement this test. 
    $this->markTestIncomplete(
      'This test has not been implemented yet.' 
    ); 
} 

我必須做一些愚蠢的,但我想不出什麼。是否在生成的@covers註釋中擴展類名稱和方法名稱可能是一條線索?

我在使用PHP 5.3.6和PHPUnit 3.6.2的Mac上運行NetBeans 7.0.1。

回答

4

所有註釋必須出現在以/**開頭的DocBlock註釋中,而不是/*。你錯過了一個星號。

/** 
* @assert (0) == NULL 
*/ 
public static function factory($num) {