更新时间:2023-02-14 15:03:45
您可以将setOutputCallback设置为不执行操作"功能.效果是抑制测试或测试类中打印的任何输出.
You can set the setOutputCallback to a do nothing function. The effect is to suppress any output printed in the test or in the tested class.
例如:
namespace Acme\DemoBundle\Tests;
class NoOutputTest extends \PHPUnit_Framework_TestCase {
public function testSuppressedOutput()
{
// Suppress output to console
$this->setOutputCallback(function() {});
print '*';
$this->assertFalse(false, "Don't see the *");
}
}
您可以在文档中找到一些参考.
You can find some reference in the doc
希望获得帮助