Open
Conversation
It does not check what it should, even after removing `ServiceLocator` condition in `ContainerInterfacePrivateServiceRule` tests are green.
Accessing services from `ServiceProviderInterface` (which extends `ContainerInterface`) should not trigger "Service is private".
Contributor
Author
|
@ondrejmirtes @lookyman any news on this? |
Contributor
Author
|
@ondrejmirtes @lookyman friendly ping 😉 |
ondrejmirtes
requested changes
Sep 21, 2022
Member
ondrejmirtes
left a comment
There was a problem hiding this comment.
I don't understand why this is tested by removing code from tests. Typically you should test things by adding more code?
Contributor
Author
|
@ondrejmirtes I described it in the PR's description 🤷♂️ I really would like to provide proper test cases, but I had hard time with that and just asked for help here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@ondrejmirtes I've added support for
ServiceProviderInterfaceand checked it against our codebase - after my changes and implementing this interface in our locators (mentioned here) I don't have errors, so rule is working properly.But I had tough time with this mostly because of test scenario provided in #151 which IMHO does not work as expected. I started by adding
ExampleController::privateServiceFromServiceProvider()but wanted to make it fail and I couldn't. After several tries I just checked what will happen if I remove$isServiceLocatorfromContainerInterfacePrivateServiceRuleand... tests were still green. So I've just removed those services fromtests/Rules/Symfony/container.xmlcompletely and I would like to provide proper test cases for service locator/provider but I don't know how 😅 I've tried to create some example files, loaded in new test method withinContainerInterfacePrivateServiceRuleTest, but I did not manage to achieve failing scenario, which could be fixed by my changes. Could you help me with this (or @lookyman)?