You are here

public function LegacyProgressHelperTest::testOverwriteWithShorterLine in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Tests/Helper/LegacyProgressHelperTest.php \Symfony\Component\Console\Tests\Helper\LegacyProgressHelperTest::testOverwriteWithShorterLine()

File

vendor/symfony/console/Tests/Helper/LegacyProgressHelperTest.php, line 93

Class

LegacyProgressHelperTest
@group legacy

Namespace

Symfony\Component\Console\Tests\Helper

Code

public function testOverwriteWithShorterLine() {
  $progress = new ProgressHelper();
  $progress
    ->setFormat(' %current%/%max% [%bar%] %percent%%');
  $progress
    ->start($output = $this
    ->getOutputStream(), 50);
  $progress
    ->display();
  $progress
    ->advance();

  // set shorter format
  $progress
    ->setFormat(' %current%/%max% [%bar%]');
  $progress
    ->advance();
  rewind($output
    ->getStream());
  $this
    ->assertEquals($this
    ->generateOutput('  0/50 [>---------------------------]   0%') . $this
    ->generateOutput('  1/50 [>---------------------------]   2%') . $this
    ->generateOutput('  2/50 [=>--------------------------]     '), stream_get_contents($output
    ->getStream()));
}