NetBeans PHPUnit测试生成忽略@assert注释

时间:2011-11-06 15:50:25

标签: netbeans phpunit

我有一个抽象类,源代码如下所示:

/*
 * @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。

1 个答案:

答案 0 :(得分:4)

所有注释都必须出现在以/**而不是/*开头的DocBlock评论中。你错过了一个星号。

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