doudg60800
2012-05-23 17:33
浏览 35
已采纳

Phpunit - 如何注释测试?

I'd like to run my tests in separate processes. Because of this, I would like to annotate my tests with "@runTestsInSeparateProcesses". However, I have never annotated Phpunit tests before and I haven't been able to find a good description of where to actually put the annotations. I've seen what the different annotations do, just not where to put them. Could someone please give me an example?

Thanks!

图片转代码服务由CSDN问答提供 功能建议

我想在不同的进程中运行我的测试。 因此,我想用“@runTestsInSeparateProcesses”注释我的测试。 但是,我之前从未注释过Phpunit测试,但我无法找到实际放置注释的好地方。 我已经看到了不同注释的作用,而不是放在哪里。 有人可以举个例子吗?

谢谢!

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doushi1473 2012-05-23 17:40
    已采纳

    Annotations are applied to your test-case's docblock:

    /**
     * Short Description
     * 
     * @param string $input The test input
     * 
     * @return bool The result
     * 
     * @runTestsInSeparateProcesses
     */
    public function test_myMethod ($input) {
      // Test code here
    }
    

    Read more about DocBlocks: https://docs.phpdoc.org/

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题