您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
phpunit-phpunit.xml-phpunit-beStrictAboutTodoAnnotatedTests
发布时间:2021-10-16 22:38:46编辑:雪饮阅读()
beStrictAboutTodoAnnotatedTests 属性
可能值:true 或 false(默认值:false)
此属性配置在测试有 @todo 标注时,PHPUnit 是否应将其标记为有风险。
todo是什么?
这个暂时不晓得。
有todo标记的默认执行情况:
MyTest.php:
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class MyTest extends TestCase
{
/**
* @todo
*/
public function testOne(): void
{
$this->assertTrue(true);
}
/**
* @todo
*/
public function testTwo(): void
{
$this->assertTrue(true);
}
public function testThree(): void
{
$this->assertTrue(true);
}
}
运行结果:
C:\Users\Administrator>D:\phpstudy_pro\Extensions\php\php7.4.3nts\php.exe D:\phpstudy_pro\WWW\phpunitLearning\phpunitLearning-beStrictAboutTodoAnnotatedTests\phpunit-9.5.10.phar D:\phpstudy_pro\WWW\phpunitLearning\phpunitLearning-beStrictAboutTodoAnnotatedTests\MyTest.php
PHPUnit 9.5.10 by Sebastian Bergmann and contributors.
... 3 / 3 (100%)
Time: 00:00.003, Memory: 18.00 MB
OK (3 tests, 3 assertions)
看来是没有标记风险的
配置了beStrictAboutTodoAnnotatedTests为true:
phpunit.xml:
<phpunit beStrictAboutTodoAnnotatedTests="true">
</phpunit>
那么运行结果:
C:\Users\Administrator>D:\phpstudy_pro\Extensions\php\php7.4.3nts\php.exe D:\phpstudy_pro\WWW\phpunitLearning\phpunitLearning-beStrictAboutTodoAnnotatedTests\phpunit-9.5.10.phar -c D:\phpstudy_pro\WWW\phpunitLearning\phpunitLearning-beStrictAboutTodoAnnotatedTests\phpunit.xml D:\phpstudy_pro\WWW\phpunitLearning\phpunitLearning-beStrictAboutTodoAnnotatedTests\MyTest.php
PHPUnit 9.5.10 by Sebastian Bergmann and contributors.
RR. 3 / 3 (100%)
Time: 00:00.003, Memory: 18.00 MB
There were 2 risky tests:
1) MyTest::testOne
Test method is annotated with @todo
2) MyTest::testTwo
Test method is annotated with @todo
OK, but incomplete, skipped, or risky tests!
Tests: 3, Assertions: 3, Risky: 2.
可以看到前两个有todo标记的测试方法都被标记为risky风险。
关键字词:phpunit,beStrictAboutTodoAnnotatedTests
相关文章
- phpunit-phpunit.xml-beStrictAboutTestsThatDoNotTes
- phpunit-phpunit.xml-phpunit-beStrictAboutOutputDur
- phpunit-phpunit.xml-phpunit-stopOnDefect
- phpunit-phpunit.xml-stopOnSkipped
- phpunit-phpunit.xml-phpunit-stopOnRisky
- phpunit-phpunit.xml-phpunit-stopOnIncomplete
- phpunit-phpunit.xml-phpunit-stopOnFailure
- phpunit-phpunit.xml-phpunit-stopOnError
- phpunit-phpunit.xml-phpunit-printerClass与printerF
- phpunit-phpunit.xml-phpunit-processIsolation