yiisoft / yii-http-client

Deprecated in favor of existing PSR-18 implementations

Home Page:https://www.yiiframework.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unreliable test

hiqsol opened this issue · comments

What steps will reproduce the problem?

phpunit

What do you get instead?

Sometimes tests pass, sometimes not.
Failing while fetching from some urls.
Seen on Travis.

Why are there tests that depend from testSend() ?

I think that tests are doing too much short requests to php.net and the remote server will block them.

I don't think that removing "depends" fixes the problem mentioned by @hiqsol

Using "depends" doesn't retrigger the refered test, unless I'm misunderstanding something.

Also, I really don't think the PHP.net mirror picked up by the test will ban you after a few requests, even if they are too close. Maybe one of the mirrors that gets picked up for one particular test is failing.

Maybe we could switch from php.net to yiiframework.com, to have a more "reliable" source.

We might also consider mocking network operations, as we are not interested in testing the underlying library performing the request (curl, sockets,..) but instead we're interested in testing the created request and its parsed response.