我有 phpunit 3.7
- 在文档中3.6,附录B, http://www.phpunit.de/manual/3.6/en/appendixes.annotations.html有一个
@assert
注释,而
- 在文档中3.7,附录B, http://www.phpunit.de/manual/3.7/en/appendixes.annotations.html有no
@assert
注解
The 官方公告 http://sebastian-bergmann.de/archives/923-PHPUnit-3.7.html提到了一些新的注释(以及重新引入之前已弃用的旧注释),但没有提到删除@assert
。
在里面3.7 的变更日志。 https://github.com/sebastianbergmann/phpunit/blob/3.7/ChangeLog.md, @assert
页面上找不到
当我使用以下命令在类上运行代码时代码片段 http://www.sitepoint.com/advanced-phpunit-testing-annotations-and-mocking/
<?php
class MyMathClass
{
/**
* Add two given values together and return sum
* @assert (1,2) == 3
*/
public function addValues($a,$b)
{
return $a+$b;
}
}
输出是
PHPUnit 3.7.1 by Sebastian Bergmann.
Time: 1 second, Memory: 4.25Mb
No tests executed!
与 PHP 3.6.2
phpunit MyMathClass.php
PHPUnit 3.6.12 by Sebastian Bergmann.
.
Time: 0 seconds, Memory: 2.75Mb
OK (1 test, 1 assertion)
经过一些研究后回答我自己的问题。感谢评论者让我走上正轨。
注释消失了,因为它已移至optionalPHPUnit_SkeletonGenerator 包。
此时,有两个令人困惑的问题:
- 从 phpunit“core”中删除 @assert 注释
- 文档没有正确更新
变更日志不精确。它说(错误地):
删除了已弃用的 --骷髅-class 和 --骷髅-测试 开关。这
功能现在由 phpunit 提供-skel的命令
PHPUnit_SkeletonGenerator 包。
更好的说法听起来更像是这样:
删除了已弃用的 --骷髅-class 和 --骷髅-测试 开关。这
功能现在由可选的 phpunit- 提供skelgenPHPUnit_SkeletonGenerator 包的命令。
因此,@assert 注释已从 phpunit 核心中删除。
通过 PEAR 安装 PHPUnit_SkeletonGenerator 后即可使用。
也许我会通过 github 自己更改它并通知维护人员。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)