Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Console] Fix bug with format, when set max count, by start method in progress bar #16149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

vsychov
Copy link
Contributor

@vsychov vsychov commented Oct 6, 2015

When I set max count, by call "ProgressBar::start()", I got invalid progress bar format.

Example code:

$bar = new ProgressBar($output, 100);
$bar->start();
$bar->advance(100);
$bar->finish();

Output:
100/100 [============================] 100%

Example code:

$bar = new ProgressBar($output);
$bar->start(100);
$bar->advance(100);
$bar->finish();

Output:
100 [============================]

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

@fabpot
Copy link
Member

fabpot commented Oct 6, 2015

Can you add a test to avoid regressions in the future?

@xabbuh xabbuh added the Console label Oct 6, 2015
@vsychov
Copy link
Contributor Author

vsychov commented Oct 8, 2015

Done

@vsychov vsychov changed the title Fix bug with format, when set max count, by start method in progress bar [Console] Fix bug with format, when set max count, by start method in progress bar Oct 8, 2015
@fabpot
Copy link
Member

fabpot commented Oct 11, 2015

LGTM. I've created #16196 where I've added another commit to fix the case where setFormat() is called before start(); I've also based the PR on 2.7 as the bug exists there as well. Thanks.

@fabpot fabpot closed this Oct 11, 2015
fabpot added a commit that referenced this pull request Oct 11, 2015
…tart() and some other edge cases (vsychov, fabpot)

This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Fix progress bar formatting when max is set on start() and some other edge cases

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Besides what #16149 fixed, it also fixes the case where `setFormat()` is called before `start()`.

From #16149

When I set max count, by call "ProgressBar::start()", I got invalid progress bar format.

Example code:
```php
$bar = new ProgressBar($output, 100);
$bar->start();
$bar->advance(100);
$bar->finish();
```
Output:
 100/100 [============================] 100%

Example code:
```php
$bar = new ProgressBar($output);
$bar->start(100);
$bar->advance(100);
$bar->finish();
```
Output:
 100 [============================]

Commits
-------

e651da4 [Console] fixed progress bar format on edge cases
3cbfa63 fix bug with set max count, by start method in progress bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants