2
votes

I have an abstract class where source code looks like this:

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

    //do some other stuff
}

If I delete the previously generated test file and use the "Create PHPUnit tests", it creates a new unit test file that doesn't seem to have taken the assert into account at all:

/**
 * @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.'
    );
}

I must be doing something silly, but I can't figure out what. Is the failure to expand the class name and method name in the generated @covers annotation perhaps a clue?

I'm running NetBeans 7.0.1 on a Mac with PHP 5.3.6 and PHPUnit 3.6.2.

1

1 Answers

4
votes

All annotations must appear in DocBlock comments which start with /** and not /*. You're missing an asterisk.

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