Skip to content

Commit

Permalink
[Console] Remove estimated field from debug_nomax
Browse files Browse the repository at this point in the history
  • Loading branch information
bburnichon authored and stof committed Jul 15, 2014
1 parent 6a41ca0 commit 2ac1bb4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Symfony/Component/Console/Helper/ProgressBar.php
Expand Up @@ -547,13 +547,13 @@ private static function initFormats()
'normal_nomax' => ' %current% [%bar%]',

'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
'verbose_nomax' => ' %current% [%bar%] %percent:3s%% %elapsed:6s%',
'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',

'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
'very_verbose_nomax' => ' %current% [%bar%] %percent:3s%% %elapsed:6s%',
'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',

'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
'debug_nomax' => ' %current% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
);
}
}
28 changes: 28 additions & 0 deletions src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php
Expand Up @@ -404,6 +404,34 @@ public function testSetFormat()
);
}

/**
* @dataProvider provideFormat
*/
public function testFormatsWithoutMax($format)
{
$bar = new ProgressBar($output = $this->getOutputStream());
$bar->setFormat($format);
$bar->start();

rewind($output->getStream());
$this->assertNotEmpty(stream_get_contents($output->getStream()));
}

/**
* Provides each defined format
*
* @return array
*/
public function provideFormat()
{
return array(
array('normal'),
array('verbose'),
array('very_verbose'),
array('debug'),
);
}

protected function getOutputStream($decorated = true)
{
return new StreamOutput(fopen('php://memory', 'r+', false), StreamOutput::VERBOSITY_NORMAL, $decorated);
Expand Down

0 comments on commit 2ac1bb4

Please sign in to comment.