PHPUnit 忽略注解

PHPUnit ignores annotations

我在测试一个简单的 laravel 项目时遇到问题。 Laravel版本为5.1,PHPUnit版本为5.2.4。 示例:

<?php
class MissionTest extends TestCase {
    /*
     * @test
     */
    public function f1() {
        return [];
    }

    /*
     * @test
     * @depends f1
     */
    public function f2($a) {
        dd($a);
    }

    public function testF1() {
        return [];
    }

    /*
     * @depends testF1
     */
    public function testF2($a) {
        dd($a);
    }
}
?>

预期的行为是执行 f1 打印一个句号,然后执行 f2 并输出一个空数组。实际发生的是测试 f1 和 f2 被忽略,执行 testF1 导致一个句号,然后执行 testF2 导致一个 E。例外是:

ErrorException: Missing argument 1 for MissionTest::testF2()

我刚开始使用 PHPUnit,但无论我如何尝试,都无法让它按预期工作。任何帮助将不胜感激。

编辑:忘记提及 TestCase 扩展了 Illuminate\Foundation\Testing\TestCase 并简单地覆盖了 createApplication 方法。

这就是它的工作原理。检查 the documentation。它突出显示:

A doc comment in PHP must start with /** and end with */. Annotations in any other style of comment will be ignored.