[Console] Remove estimated field from debug_nomax

This commit is contained in:
Benoît Burnichon 2014-07-03 14:18:43 +02:00 committed by Christophe Coevoet
parent 6a41ca04dd
commit 2ac1bb45bc
2 changed files with 32 additions and 4 deletions

View File

@ -547,13 +547,13 @@ class ProgressBar
'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%',
);
}
}

View File

@ -404,6 +404,34 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
);
}
/**
* @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);