Files
yii2/tests/framework/console/controllers/StdOutBufferControllerTrait.php
╃巡洋艦㊣ 586684b050 2.0.5 bf7edc5
2015-07-30 09:52:33 +08:00

27 lines
612 B
PHP

<?php
namespace yiiunit\framework\console\controllers;
/**
* StdOutBufferControllerTrait is a trait, which can be applied to [[yii\console\Controller]],
* allowing to store all output into internal buffer instead of direct sending it to 'stdout'
*/
trait StdOutBufferControllerTrait
{
/**
* @var string output buffer.
*/
private $stdOutBuffer = '';
public function stdout($string)
{
$this->stdOutBuffer .= $string;
}
public function flushStdOutBuffer()
{
$result = $this->stdOutBuffer;
$this->stdOutBuffer = '';
return $result;
}
}