脚本宝典收集整理的这篇文章主要介绍了PHPUnit:强制显示被断言的值,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
class YourtestCase extends PHPUnit_Framework_TestCase { ... static PRivate $messages = array(); ... static public function assertSame($VAR1,$var2,$message = '') { parent::assertSame($var1,$message); // assertSame() throws an exception if not true,so the following // won't occur unless the messages actually are the same $success = print_r($var1,true) . ' is the same as ' . print_r($var2,true); self::$messages = array_merge(self::$messages,array($success)); } static public function tearDownAfterClass() { echo implode("\n",self::$messages); } }
当然,tearDownAfterClass()可能不足以适应你的喜好.这与断言失败是不一样的.
以上是脚本宝典为你收集整理的PHPUnit:强制显示被断言的值全部内容,希望文章能够帮你解决PHPUnit:强制显示被断言的值所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。