-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Console] Add support for Invokable Commands in CommandTester
#60823
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
Conversation
CommandTester and Application
|
Sure I could wrap them manually in |
|
I updated the target branch to 7.4, this is a new feature that cannot be merged into 7.3 |
2e104a7 to
beea196
Compare
|
Thanks, it seems that the Application was already fixed in 7.4 #60394 |
CommandTester and ApplicationCommandTester
GromNaN
left a comment
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.
That's good, there are a few things to fix to clean up the PR.
Thanks for the new test.
beea196 to
74ca920
Compare
|
@GromNaN Done, also updated the changelog! |
47ff4cc to
e1d9dce
Compare
GromNaN
left a comment
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.
The test needs to be modified, and then we're all good!
src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php
Outdated
Show resolved
Hide resolved
|
@GromNaN Done, I also added another commit with extra tests. |
yceruto
left a comment
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.
Thanks @ruudk for the improvement!
src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php
Outdated
Show resolved
Hide resolved
40a5a5f to
a10ae7f
Compare
|
Thank you @ruudk. |
This PR was merged into the 7.4 branch. Discussion ---------- [Console] Cleanup test for invokable command | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT A slight cleanup after #60823. Commits ------- df467e2 [Console] Cleanup test
|
I got the question about testing invokable commands in Symfony 7.3. While this feature will be released in Symfony 7.4, here are two solutions:
|
|
Third testing option for 7.3: use |
I'm trying out the amazing new Invokable Commands introduced in Symfony 7.3 but I noticed that I could use it together with the CommandTester. It was also not possible to manually add these type of commands to the Application.
I'm not sure what the best approach is with this. As I'm changing the signature of the methods this might be considered a breaking change. Or it might not, as I'm widening the type from Command to object.
Please advise what the best approach would be to introduce something like this. Thanks 🙏
/cc @yceruto @chalasr