简体   繁体   English

phpunit-如何注释测试?

[英]Phpunit - How do I annotate tests?

I'd like to run my tests in separate processes. 我想在单独的过程中运行测试。 Because of this, I would like to annotate my tests with "@runTestsInSeparateProcesses". 因此,我想用“ @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. 但是,我之前从未对Phpunit测试进行注释,也无法找到关于将注释实际放置到何处的良好描述。 I've seen what the different annotations do, just not where to put them. 我已经看到了不同注释的作用,只是没有看到它们的放置位置。 Could someone please give me an example? 有人可以给我一个例子吗?

Thanks! 谢谢!

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/ 进一步了解DocBlocks: https//docs.phpdoc.org/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM