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

Completed the needed context to successfully test commands with Helpers #4582

Closed
wants to merge 1 commit into from
Closed

Completed the needed context to successfully test commands with Helpers #4582

wants to merge 1 commit into from

Conversation

peterrehm
Copy link
Contributor

Q A
Doc fix? yes
New docs? no
Applies to all
Fixed tickets #4581

As mentioned in symfony/symfony#12798 the explanation about the initialization is not clear.
Therefore I have added the needed context and a reference to the related cookbook article.

@@ -254,6 +254,9 @@ from the command line, you need to overwrite the HelperSet used by the command::
public function testExecute()
{
// ...
$application = new Application();
Copy link
Contributor

Choose a reason for hiding this comment

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

whats about the use statements?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are there now.

Copy link
Contributor

Choose a reason for hiding this comment

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

can't see them

Copy link
Member

Choose a reason for hiding this comment

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

They are there now :)

@@ -279,3 +284,7 @@ By setting the input stream of the ``DialogHelper``, you imitate what the
console would do internally with all user input through the cli. This way
you can test any user interaction (even complex ones) by passing an appropriate
input stream.

.. seealso::
Copy link
Member

Choose a reason for hiding this comment

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

You should add a blank line between the directive and the text.

@peterrehm
Copy link
Contributor Author

Updated.

@@ -411,6 +411,8 @@ tools capable of helping you with different tasks:
* :doc:`/components/console/helpers/tablehelper`: displays tabular data as a table
* :doc:`/components/console/helpers/dialoghelper`: (deprecated) interactively ask the user for information

.. _book-console-testing-commands:
Copy link
Member

Choose a reason for hiding this comment

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

components-console-testing-commands would fit better.

@peterrehm
Copy link
Contributor Author

Once more.. updated.

@peterrehm
Copy link
Contributor Author

@wouterj @xabbuh I think this is finished.

@wouterj
Copy link
Member

wouterj commented Dec 24, 2014

Yes, it is. Thank you @peterrehm !

@@ -247,13 +247,18 @@ Testing a Command which Expects Input
If you want to write a unit test for a command which expects some kind of input
from the command line, you need to overwrite the HelperSet used by the command::

use Symfony\Bundle\FrameworkBundle\Console\Application;
Copy link
Member

Choose a reason for hiding this comment

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

I think we should not use the Application class from the FrameworkBundle in the components section, but use the Symfony\Component\Console\Application class instead.

@xabbuh
Copy link
Member

xabbuh commented Dec 24, 2014

@peterrehm We just have to fix the namespace in the use statement for the Application class. Sorry for missing this earlier.

@peterrehm
Copy link
Contributor Author

Updated.

@wouterj
Copy link
Member

wouterj commented Dec 28, 2014

And in the end, the PR can be merged. Thanks for your patience and good job, Peter!

wouterj added a commit that referenced this pull request Dec 28, 2014
…with Helpers (peterrehm)

This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #4582).

Discussion
----------

Completed the needed context to successfully test commands with Helpers

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | all
| Fixed tickets | #4581

As mentioned in symfony/symfony#12798 the explanation about the initialization is not clear.
Therefore I have added the needed context and a reference to the related cookbook article.

Commits
-------

a94bd71 Completed the needed context to successfully test commands
@wouterj wouterj closed this Dec 28, 2014
@peterrehm peterrehm deleted the test-helper-set branch December 31, 2014 14:32
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