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

Allow multiple options for --colors flag #1526

Closed
wants to merge 3 commits into from

Conversation

jbladen
Copy link

@jbladen jbladen commented Dec 12, 2014

Retargetted from #1525

@henriquemoody
Copy link
Contributor

I'm sorry, I haven't see this pull request before I sent mine (#1527).

if (is_null($option[1]) || in_array($option[1], array('always', 'force', 'yes'))) {
$this->arguments['colors'] = true;
} elseif (in_array($option[1], array('auto', 'tty', 'if-tty'))) {
if (function_exists('posix_isatty') && !posix_isatty(STDOUT)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to use $console->hasColorSupport() here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no $console in scope, which from the Environment project only wraps the same check?

@@ -280,8 +280,18 @@ protected function handleArguments(array $argv)
foreach ($this->options[0] as $option) {
switch ($option[0]) {
case '--colors': {
$this->arguments['colors'] = true;
if (is_null($option[1]) || in_array($option[1], array('always', 'force', 'yes'))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO its too much code to put here, you may create another method for that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, as @remicollet already said in the other pul request you must add true here.

@henriquemoody
Copy link
Contributor

@jbladen, besides the help message, may you create a PHPT test to ensure the --colors is working as expected? You may check the TTY in the --SKIPIF-- session.

@@ -280,8 +280,18 @@ protected function handleArguments(array $argv)
foreach ($this->options[0] as $option) {
switch ($option[0]) {
case '--colors': {
$this->arguments['colors'] = true;
if (is_null($option[1]) || in_array($option[1], array('always', 'force', 'yes'))) {
$this->arguments['colors'] = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not going to work as expected because of the checking in PHPUnit_TextUI_ResultPrinter.

@sebastianbergmann
Copy link
Owner

At first glance I think that I prefer #1527 over this one.

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

Successfully merging this pull request may close these issues.

4 participants