-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Conversation
@@ -254,6 +254,9 @@ from the command line, you need to overwrite the HelperSet used by the command:: | |||
public function testExecute() | |||
{ | |||
// ... | |||
$application = new Application(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't see them
There was a problem hiding this comment.
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:: |
There was a problem hiding this comment.
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.
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: |
There was a problem hiding this comment.
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.
Once more.. updated. |
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; |
There was a problem hiding this comment.
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.
@peterrehm We just have to fix the namespace in the |
Updated. |
And in the end, the PR can be merged. Thanks for your patience and good job, Peter! |
…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
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.