The string is formatted before it is written to the output stream.
public writeLine ( string $string, integer $flags = null ) | ||
$string | string | The string to write. A newline is appended. |
$flags | integer | The flags. If one of of {@link IO::VERBOSE}, {@link IO::VERY_VERBOSE} and {@link IO::DEBUG} is passed, the output is only written if the verbosity level is the given level or higher. |
public function testWriteLineRemovesTagsIfAnsiNotSupported() { $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->writeLine('<tag>text</tag>'); $this->assertSame('text' . PHP_EOL, $stream->fetch()); }
/** * Writes a line of text to the error output. * * The string is formatted before it is written to the output. * * @param string $string The string to write. A newline is appended. * @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 errorLine($string, $flags = null) { $this->errorOutput->writeLine($string, $flags); }