Skip to content

[Console] Add support for error ouput in the CommandTester #27434

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

Merged
merged 1 commit into from
Sep 23, 2018

Conversation

cdekok
Copy link
Contributor

@cdekok cdekok commented May 30, 2018

Move initialization of the streams to the trait so the capture_stderr_separately also works in the CommandTester.

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #27422
License MIT
Doc PR symfony/symfony-docs#...

Make it possible to test seperate stderr output.

$tester->execute(
    array('foo' => 'bar'),
    array('capture_stderr_separately' => true)
);

$this->assertEquals('foo', $tester->getErrorOutput());

@@ -1,6 +1,11 @@
CHANGELOG
=========

4.1.1
Copy link
Member

Choose a reason for hiding this comment

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

4.2.0, new features are for minor releases

@@ -91,6 +117,53 @@ public function setInputs(array $inputs)
return $this;
}

/**
* Initialize the output property.
Copy link
Member

Choose a reason for hiding this comment

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

Initializes

Copy link
Member

Choose a reason for hiding this comment

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

this comment is still relevant, we use the 3rd person form to describe methods

$tester->run(array(
'command' => 'foo',
'foo' => 'bar',
),
Copy link
Member

Choose a reason for hiding this comment

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

on one line please

*
* @param array $options An array of options
*
* @return self
Copy link
Member

Choose a reason for hiding this comment

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

this one is not true and returning void is fine. Both @param and @return annotations should be removed as they do not provide any information that is not already provided by the method signature.

@@ -42,6 +41,7 @@ public function __construct(Command $command)
* * interactive: Sets the input interactive flag
* * decorated: Sets the output decorated flag
* * verbosity: Sets the output verbosity flag
* * capture_stderr_separately: Make output of stdOut and stdErr separately available
Copy link
Contributor

Choose a reason for hiding this comment

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

should be aligned

Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

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

@cdekok Would you mind addressing the remaining minor comments and rebase your branch?

@chalasr chalasr changed the title Add support for error ouput in the CommandTester [Console] Add support for error ouput in the CommandTester Sep 23, 2018
@chalasr chalasr force-pushed the feature/command-tester-error-output branch 5 times, most recently from 35d41c6 to 8a076d1 Compare September 23, 2018 11:23
@chalasr chalasr force-pushed the feature/command-tester-error-output branch from 8a076d1 to cec5317 Compare September 23, 2018 11:35
@chalasr
Copy link
Member

chalasr commented Sep 23, 2018

Nice first contribution! Thank you @cdekok

@chalasr chalasr merged commit cec5317 into symfony:master Sep 23, 2018
chalasr pushed a commit that referenced this pull request Sep 23, 2018
…ster (cdekok)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[Console] Add support for error ouput in the CommandTester

Move initialization of the streams to the trait so the `capture_stderr_separately` also works in the CommandTester.

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #27422
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Make it possible to test seperate stderr output.

```$tester = new CommandTester($command);
$tester->execute(
    array('foo' => 'bar'),
    array('capture_stderr_separately' => true)
);

$this->assertEquals('foo', $tester->getErrorOutput());
````

Commits
-------

cec5317 [Console] Add support for error ouput in the CommandTester
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
This was referenced Nov 3, 2018
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.

5 participants