You are here

public function ProgressBarTest::testMultiByteSupport 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::testMultiByteSupport()

File

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

Class

ProgressBarTest

Namespace

Symfony\Component\Console\Tests\Helper

Code

public function testMultiByteSupport() {
  if (!function_exists('mb_strlen') || false === ($encoding = mb_detect_encoding('■'))) {
    $this
      ->markTestSkipped('The mbstring extension is needed for multi-byte support');
  }
  $bar = new ProgressBar($output = $this
    ->getOutputStream());
  $bar
    ->start();
  $bar
    ->setBarCharacter('■');
  $bar
    ->advance(3);
  rewind($output
    ->getStream());
  $this
    ->assertEquals($this
    ->generateOutput('    0 [>---------------------------]') . $this
    ->generateOutput('    3 [■■■>------------------------]'), stream_get_contents($output
    ->getStream()));
}