时间:2016-11-21来源:本站原创作者:佚名
1.相等断言

$this-assertEquals(0,count($stack));

错误相关信息的输出

2.依赖关系depends标注来表达测试方法之间的依赖关系。

/***

dependstestPush*/

.不为空断言

$this-assertNotEmpty($stack);

4.对异常进行测试

$this-expectException(InvalidArgumentException::class);

除了expectException()方法外,还有expectExceptionCode()、expectExceptionMessage()和expectExceptionMessageRegExp()方法可以用于为被测代码所抛出的异常建立预期。

5.异常检测标注

/**

*

expectedExceptionInvalidArgumentException

*/

6.预期错误

/**

*

expectedExceptionPHPUnit_Framework_Error*/

7.对会引发PHP错误的代码的返回值进行测试

$this-assertFalse()8.对输出的结果进行预测

$this-expectOutputString()

如果输出的结果不匹配则为FALSE

9.命令行测试执行器10.将测试标记为未完成

$this-markTestIn







































最好白癜风治疗方法
北京哪看女性白癜风好

转载请注明原文网址:http://www.coolofsoul.com/hjpz/12375.html

------分隔线----------------------------