$output->
overwrite('Bar'
);
rewind($output->
getStream());
$this->
assertEquals('Foo'.\PHP_EOL."\x1b[1A\x1b[0JBar".\PHP_EOL,
stream_get_contents($output->
getStream()));
} public function testMaxHeight() { $expected = '';
$sections =
[];
$output =
new ConsoleSectionOutput($this->stream,
$sections, OutputInterface::VERBOSITY_NORMAL, true,
new OutputFormatter());
$output->
setMaxHeight(3
);
// fill the section
$output->
writeln(['One', 'Two', 'Three'
]);
$expected .= 'One'.\PHP_EOL.'Two'.\PHP_EOL.'Three'.\PHP_EOL;
// cause overflow (redraw whole section, without first line)
$output->
writeln('Four'
);
$expected .= "\x1b[3A\x1b[0J";
$expected .= 'Two'.\PHP_EOL.'Three'.\PHP_EOL.'Four'.\PHP_EOL;
// cause overflow with multiple new lines at once