Skip to content
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

Different number of test per line #137

Closed
dirkaholic opened this issue Jan 26, 2011 · 12 comments
Closed

Different number of test per line #137

dirkaholic opened this issue Jan 26, 2011 · 12 comments
Milestone

Comments

@dirkaholic
Copy link

Hi,

don't know if it is a bug or a feature but after upgrading from 3.5.6 to 3.5.10 the number of tests shown per line differs from one test suite to the other.

Examples:

 [exec] PHPUnit 3.5.10 by Sebastian Bergmann.

 [exec] ................................................................. 65 / 78 ( 83%)
 [exec] .............

 [exec] Time: 02:21, Memory: 71.50Mb

or here:

 [exec] PHPUnit 3.5.10 by Sebastian Bergmann.

 [exec] SSSSSSSSSSSSS................................................   61 / 1558 (  3%)
 [exec] .............................................................  122 / 1558 (  7%)
 [exec] .............................................................  183 / 1558 ( 11%)
 [exec] .............................................................  244 / 1558 ( 15%)
 [exec] .............................................................  305 / 1558 ( 19%)
 ...
@sebastianbergmann
Copy link
Owner

Not a bug. The number of tests shown per line depends on the length of the string that represents the total number of tests: strlen('XX / XX') is less than strlen('XXXX / XXXX'), so there are more tests per line in the former than in the latter case.

@mrmarkfrench
Copy link

Is there a command line flag or other argument/config that can be supplied to set the desired line width in newer versions of the package? I don't find one documented anywhere.

@edorian
Copy link
Contributor

edorian commented Jan 12, 2012

@mrmarkfrench The output is designed to fit into a 80x terminal. The width is hardcoded in PHPUnit/TextUI/ResultPrinter.php:545 function startTestSuite

$this->maxColumn     = 69 - (2 * $this->numTestsWidth);

I don't really see why it would be useful to make it configurable but then again as long as it is xml configuration only (no new cli switches) It might not hurt ether.

@mrmarkfrench
Copy link

@edorian Yeah, I found the line of code. I was just hoping that there was a solution I could handle in my configs, rather than needing to modify that line of code each time I upgrade to a new version of the package.

I understand that it is set to fit on an 80-column terminal, but this is no longer 1978, and I don't code on a VT100, so some flexibility to allow me to use more columns (and as a result fewer lines) would be helpful in my development environment. I grant you that lots of people still use 80-column terminals, so I think that's a great default, but the option to change it with a config would be a nice piece of flexibility.

@indeyets
Copy link

indeyets commented Jul 7, 2012

phpunit could use COLUMNS environment variable when it is available. It is automatically populated by zsh and bash.

in cases when it is not set, sticking to 80 is a sane fallback

@edorian edorian reopened this Jul 27, 2012
@edorian
Copy link
Contributor

edorian commented Jul 27, 2012

I like the suggestion of using the COLUMNS variable. I'd implement it like that if @sebastianbergmann also likes it :)

@sebastianbergmann
Copy link
Owner

Fine by me. Thanks!

@edorian
Copy link
Contributor

edorian commented Jul 28, 2012

The LINES and COLUMNS variables are not populated/exported to php and are not available via getenv or $_ENV by default.

The usable workarounds* seems to ether rely on seldomly installed extensions or on exec calls both of which don't make much sense to me for that usecase.

It's a shame. I'd like to have the feature even so to me, to be honest, it doesn't look all that great on a 180 col layout having only 8 very long lines for ~2k tests. But thats presumably just me being used to that.

If someone knows a way to access this vars without using exec I'd like to hear it.

For now the only thing I could see us doing is to allow for a fixedProgressBarWidth setting for the xml config. (For all the other output we don't insert linebreaks do having a termWidth setting might be misleading?)

http://stackoverflow.com/questions/2203437/how-to-get-linux-console-columns-and-rows-from-php-cli
http://stackoverflow.com/questions/263890/how-do-i-find-the-width-height-of-a-terminal-window

@indeyets
Copy link

In bash, one should explicitly export COLUMNS in .bashrc

In zsh it is exported by default, I think. But I might be wrong

@zerkms
Copy link

zerkms commented Jul 17, 2013

I run functional tests (selenium with real browsers) using phpunit and it takes some time to finish.
The <exec> ant task only outputs the line when it's terminated with end line character, so I have to wait until the whole line of dots is filled and it may take minutes for that.

If it was parameterized - I would just set the width to something between 1..5 and get the information faster

@Black-Room-Boy
Copy link

Hello. I would like to change the number of columns that phpunit is using to output test results to 140 columns. I am using Linux and phpunut 4.2.2. built in Codeception. Is there any easy way to do this ? Thanks

@sebastianbergmann sebastianbergmann added this to the PHPUnit 4.5 milestone Oct 22, 2014
axiac pushed a commit to axiac/phpunit that referenced this issue May 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants