-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Testing commands with mocked dependencies fails since 3.0.3 #18558
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
Comments
@ruudvanderweijde Could you fork the Symfony Standard Edition and make the changes that are necessary to reproduce your issue? |
I did (see ruudvanderweijde/symfony-standard@6ceaf60) and found something weird. The test was all fine, until I require mockery/mockery. Then when I run the test (even without no using mockery) the test fails. |
It seems not to be related to mockery, it is related to Steps to reproduce:
Result:
|
The behaviour you observe is related to the changes done in #17569. |
@ruudvanderweijde Does #20442 fix your issue? |
@xabbuh No, still the same error. I noticed that I removed my local repository. Want me to clone symfony-standard again? |
@ruudvanderweijde That would be nice. |
@xabbuh ruudvanderweijde/symfony-standard@d897fd8 I noticed that it doesn't matter wether or not I'm adding the command the the application: ruudvanderweijde/symfony-standard@d897fd8#diff-c1f483ff17980e2a7d449c0d09efcca9R25 |
…egistered by the kernel (aaa2000) This PR was merged into the 2.7 branch. Discussion ---------- [FrameworkBundle][Console] Fix the override of a command registered by the kernel | Q | A | ------------- | --- | Branch? |2.7 | Bug fix? | yes | New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget updating UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | #18558 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | <!--highly recommended for new features--> <!-- - Bug fixes must be submitted against the lowest branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the 3.4, legacy code removals go to the master branch. - Please fill in this template according to the PR you're about to submit. - Replace this comment by a description of what your PR is solving. --> Fix the override of a command registered by the kernel Commits ------- 3e6643b [FrameworkBundle][Console] Fix the override of a command registered by the kernel
In symfony 3.0.2 and before you could test a console command with mocks like:
But since 3.0.3 the mocked object is not set in the console command when it is executed.
A way to work around it is:
But then I cannot use the
$application->find()
method.Was this a desired change? I cannot seem to find it in the change log.
The text was updated successfully, but these errors were encountered: