-
Notifications
You must be signed in to change notification settings - Fork 130
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
Issue#282: call setContainer on ContainerAwareInterface #293
base: master
Are you sure you want to change the base?
Conversation
Autowired controllers break when not calling setContainer on ContainerAwareInterface implementations.
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 code looks good. Is it covered though?
Honestly not really familiar with unit tests, can you give me some pointers? I'll try to write some soon. |
I'm on my phone all this week end so it won't be easy . Read .travis.yml to see how to read them, and make a deliberate mistake in the existing part of the code you modified. If it is covered, the tests should break. |
When I add
Same effect when I add the My guess is that the code is covered, then? :) |
It means the existing code is covered indeed :) you might want to try throwing inside the if statements now, and check that they are covered too, and add more tests if they are not. |
First and third if-statements aren't covered. I'll see what I can do with tests tomorrow. Thanks for the feedback! |
Cleans up some unnecessary files.
I can't really wrap my head around the fact the tests fail for php 5.x and not for 7.x When I try to debug the test for the autowired controller on 7.x, the code is executed properly, but whenever I debug the controller on 5.x, it seems the code isn't executed and the test fails telling me the Route could not be found. The Any ideas? |
You could try generating traces with xdebug_start_trace() and compare them |
The third if is now covered. The first if not yet. When would a Controller already be set on the Container, but not yet be instantiated? In a sub request a new Container would be created, no? I can't think of another scenario in which the first if ( Any idea? |
Maybe if a controller fowards to itself? Not sure if what I am saying is clever or utterly stupid... |
It seems during a forward another Container is instantiated for the sub-request while forwarding. I'll try to investigate further. |
Any news about this pull request which may fix the issue about Symfony 3.3 Auto-wiring on controllers ? |
Is this ready to merge? Or are there still some things to cover with tests? |
There's still one check to be written, but I don't know how to reproduce it with a test. #293 (comment) Any feedback would be appreciated. |
Autowired controllers break when not calling setContainer on
ContainerAwareInterface implementations.