-
Notifications
You must be signed in to change notification settings - Fork 46
Adding tests for Symfony Httplug Async #159
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
i don't think this is the correct fix. @Nyholm made a precondition based on an interface. if the scenario does have that interface available but is still not able to instantiate, we need to add additional criteria for instantiation. i guess the problem is that checking for the interface can not tell if any implementation is available. but if there is a whole bunch of possible implementations, i dunno how we can determine if there is one of them present... @Nyholm do you have an idea how to handle it? could we tentatively call some factory to see if it finds a solution? |
I love this library but the past few months it feels like we've done too many patch fixes.. @XWB Can you have a look here: https://github.com/php-http/discovery/blob/1.7.3/.travis.yml#L59-L67 and provide your own test that represent your application to show what is broken? |
I''l try to make a test. In the meantime, here's the stack trace: at Http\Discovery\Exception\DiscoveryFailedException::create(array(object(PuliUnavailableException), object(NoCandidateFoundException), object(NoCandidateFoundException)))
(vendor/php-http/discovery/src/ClassDiscovery.php:79)
at Http\Discovery\ClassDiscovery::findOneByType('Psr\\Http\\Message\\ResponseFactoryInterface')
(vendor/php-http/discovery/src/Psr17FactoryDiscovery.php:53)
at Http\Discovery\Psr17FactoryDiscovery::findResponseFactory()
(vendor/symfony/http-client/HttplugClient.php:79)
at Symfony\Component\HttpClient\HttplugClient->__construct()
(vendor/php-http/discovery/src/ClassDiscovery.php:203)
at Http\Discovery\ClassDiscovery::instantiateClass('Symfony\\Component\\HttpClient\\HttplugClient')
(vendor/php-http/discovery/src/HttpAsyncClientDiscovery.php:40)
at Http\Discovery\HttpAsyncClientDiscovery::find()
(vendor/friendsofsymfony/http-cache/src/ProxyClient/HttpDispatcher.php:99) As you can see, it's trying to initialize |
That is not what I see. =) I see that you are finding the Symfony HTTPlug client. When instantiating I thought this test would cover your case: Are you using version 1.7.3? |
I do have 1.7.3 installed:
And everything works fine when I revert 366a549 so the |
Please add a test similar to the one I linked. |
@Nyholm Done. I added two tests with
|
✋ I don’t know if it will be useful. In project we use packages with versions:
|
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.
I pushed a small change to your branch.
The test will pass now.
I did a similar fix in: https://github.com/php-http/discovery/pull/157/files#diff-f6115264dc0232837d2b0b916ccb41b8R77
But I forgot the async one.
# Test that we find a client with Symfony and Guzzle | ||
- install_test will-find "Http\Discovery\HttpClientDiscovery::find();" "friendsofsymfony/http-cache-bundle:2.4.* symfony/http-client:4.* php-http/guzzle6-adapter" | ||
# Test that we find an async client with Symfony and Guzzle | ||
- install_test will-find "Http\Discovery\HttpAsyncClientDiscovery::find();" "friendsofsymfony/http-cache-bundle:2.4.* symfony/http-client:4.* php-http/guzzle6-adapter" |
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.
You can replace friendsofsymfony/http-cache-bundle:2.4.*
with php-http/client-common:2.* php-http/message:1.8*
It is the same effect.
I also added #161. Both will fix this issue. Which one do we prefer? |
@Nyholm I manually applied your fix in our application and it still fails :( |
But #161 fixes the issue! :) |
Fixed and released https://github.com/php-http/discovery/releases/tag/1.7.4 |
Fixes #158
The change introduced in 366a549 breaks our application.