You are here

public function ProgressBarTest::testOverwriteWithShorterLine in Zircon Profile 8

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

File

vendor/symfony/console/Tests/Helper/ProgressBarTest.php, line 180

Class

ProgressBarTest

Namespace

Symfony\Component\Console\Tests\Helper

Code

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

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