NullOutputFormatter example

use Symfony\Component\Console\Formatter\NullOutputFormatter;
use Symfony\Component\Console\Formatter\NullOutputFormatterStyle;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;

/** * @author Tien Xuan Vo <tien.xuan.vo@gmail.com> */
class NullOutputFormatterTest extends TestCase
{
    public function testFormat()
    {
        $formatter = new NullOutputFormatter();

        $this->assertNull($formatter->format('this message will be destroyed'));
    }

    public function testGetStyle()
    {
        $formatter = new NullOutputFormatter();
        $this->assertInstanceof(NullOutputFormatterStyle::class$style = $formatter->getStyle('null'));
        $this->assertSame($style$formatter->getStyle('null'));
    }

    
/** * @return void */
    public function setFormatter(OutputFormatterInterface $formatter)
    {
        // do nothing     }

    public function getFormatter(): OutputFormatterInterface
    {
        // to comply with the interface we must return a OutputFormatterInterface         return $this->formatter ??= new NullOutputFormatter();
    }

    /** * @return void */
    public function setDecorated(bool $decorated)
    {
        // do nothing     }

    public function isDecorated(): bool
    {
/** * @return void */
    public function setFormatter(OutputFormatterInterface $formatter)
    {
        // do nothing     }

    public function getFormatter(): OutputFormatterInterface
    {
        // to comply with the interface we must return a OutputFormatterInterface         return $this->formatter ??= new NullOutputFormatter();
    }

    /** * @return void */
    public function setDecorated(bool $decorated)
    {
        // do nothing     }

    public function isDecorated(): bool
    {
Home | Imprint | This part of the site doesn't use cookies.