public function testWriteRemovesTagsIfAnsiNotSupported() { $stream = $this->getMockBuilder('Webmozart\\Console\\IO\\OutputStream\\BufferedOutputStream')->setMethods(array('supportsAnsi'))->getMock(); $stream->expects($this->any())->method('supportsAnsi')->willReturn(false); $ansiFormatter = $this->getMockBuilder('Webmozart\\Console\\Formatter\\AnsiFormatter')->setMethods(array('format', 'removeFormat'))->getMock(); $ansiFormatter->expects($this->once())->method('removeFormat')->with('<tag>text</tag>')->willReturn('text'); $this->output->setStream($stream); $this->output->setFormatter($ansiFormatter); $this->output->write('<tag>text</tag>'); $this->assertSame('text', $stream->fetch()); }
/** * Writes a string to the error output. * * The string is formatted before it is written to the output. * * @param string $string The string to write. * @param int $flags The flags. One of {@link VERBOSE}, * {@link VERY_VERBOSE} and {@link DEBUG}. * * @throws IOException If writing fails or if the error output is closed. */ public function error($string, $flags = null) { $this->errorOutput->write($string, $flags); }