0
环境
- laravel 5.0.33
- codeception 2.0.16
App/helpers.php
laravel与codeception单元测试:使用的assertEquals时无法检查回波()
function sample($message)
{
echo $message;
}
tests/herpersTest.php
function testsample()
{
$this->assertEquals('○○○○',sample('test'));
}
我要检查的回声,但我不能检查回声和打印。
我知道只有退货支票。
我在做什么错?
'echo'不会返回任何东西,所以你不能运行这样的测试。如果您想测试是否在页面上打印了某些内容,则可以使用Laravel提供的测试工具:http://laravel.com/docs/5.0/testing,或者您可以在代码中使用Laravel模块,该模块提供了一个“ '方法:http://codeception.com/docs/modules/Laravel5#see –