Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / symfony / console / Tests / Helper / ProgressBarTest.php
index f45016982e291f20f9e6b6b3dc0b69722132de55..aca64914a9e0834ac3e8e552a815a60d6dbdf8e1 100644 (file)
@@ -354,35 +354,52 @@ class ProgressBarTest extends TestCase
 
     public function testRedrawFrequency()
     {
-        $bar = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressBar')->setMethods(array('display'))->setConstructorArgs(array($this->getOutputStream(), 6))->getMock();
-        $bar->expects($this->exactly(4))->method('display');
-
+        $bar = new ProgressBar($output = $this->getOutputStream(), 6);
         $bar->setRedrawFrequency(2);
         $bar->start();
         $bar->setProgress(1);
         $bar->advance(2);
         $bar->advance(2);
         $bar->advance(1);
+
+        rewind($output->getStream());
+        $this->assertEquals(
+            ' 0/6 [>---------------------------]   0%'.
+            $this->generateOutput(' 3/6 [==============>-------------]  50%').
+            $this->generateOutput(' 5/6 [=======================>----]  83%').
+            $this->generateOutput(' 6/6 [============================] 100%'),
+            stream_get_contents($output->getStream())
+        );
     }
 
     public function testRedrawFrequencyIsAtLeastOneIfZeroGiven()
     {
-        $bar = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressBar')->setMethods(array('display'))->setConstructorArgs(array($this->getOutputStream()))->getMock();
-
-        $bar->expects($this->exactly(2))->method('display');
+        $bar = new ProgressBar($output = $this->getOutputStream());
         $bar->setRedrawFrequency(0);
         $bar->start();
         $bar->advance();
+
+        rewind($output->getStream());
+        $this->assertEquals(
+            '    0 [>---------------------------]'.
+            $this->generateOutput('    1 [->--------------------------]'),
+            stream_get_contents($output->getStream())
+        );
     }
 
     public function testRedrawFrequencyIsAtLeastOneIfSmallerOneGiven()
     {
-        $bar = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressBar')->setMethods(array('display'))->setConstructorArgs(array($this->getOutputStream()))->getMock();
-
-        $bar->expects($this->exactly(2))->method('display');
+        $bar = new ProgressBar($output = $this->getOutputStream());
         $bar->setRedrawFrequency(0.9);
         $bar->start();
         $bar->advance();
+
+        rewind($output->getStream());
+        $this->assertEquals(
+            '    0 [>---------------------------]'.
+            $this->generateOutput('    1 [->--------------------------]'),
+            stream_get_contents($output->getStream())
+        );
     }
 
     public function testMultiByteSupport()