Fix DefaultRouteGenerator cache tests with Symfony 3.1#3899
Fix DefaultRouteGenerator cache tests with Symfony 3.1#3899soullivaneuh merged 1 commit intosonata-project:3.xfrom
Conversation
|
LGTM 👍 |
|
Seems to not be enough... |
|
I have to change my logic by updating the This should not influence anything on the codebase since a bad filepath should not be loaded at all. @sonata-project/contributors I need a review for this one. |
Symfony\Component\Config\Resource\FileResource fail if the given path is invalid since Symfony 3.1. It was the case from the begining because of mocking an interface. A condition is added to the RoutesCache class. Ref: phpDocumentor/ReflectionDocBlock#72 (comment)
|
So if I understand well, the tests are failing because we mock the Admin, but do not mock FileResource or the reflection api (how could we? they are not injected in the code…). I think this is a good temporary solution if it make the build green again, but maybe we should think about not coupling the RoutesCache to the filesystem, (and / or improve tests by mocking the filesystem ?) |
|
@greg0ire the tests are failing because of a real bug in the code. The usage of a mock only triggers this bug (because mock classes are defined through eval rather than being defined in a file) |
@stof Could you please elaborate? The code was failing because the filepath given by reflection of the Mocked Admin class returns Example: https://travis-ci.org/sonata-project/SonataAdminBundle/jobs/134243354#L500 I merge this for the moment. But I'll open an issue based on your answer. 👍 |
Thanks for the explanation @stof , if I get it right a proper fix would be to not use |
|
@greg0ire the relevant things is not what it does in its __toString method (though return |
|
Glad to learn we're fine 😅 I indeed think making this work for tests only is not worth it. |
…t#3899) Symfony\Component\Config\Resource\FileResource fail if the given path is invalid since Symfony 3.1. It was the case from the begining because of mocking an interface. A condition is added to the RoutesCache class. Ref: phpDocumentor/ReflectionDocBlock#72 (comment)
Subject
Symfony\Component\Config\Resource\FileResourcefail if the given path is invalid since Symfony 3.1.It was the case from the begining because of mocking an interface.
A condition is added to the
RoutesCacheclass.Ref: phpDocumentor/ReflectionDocBlock#72 (comment)