yiisoft / yii-http-client

Deprecated in favor of existing PSR-18 implementations
https://www.yiiframework.com/
Other
13 stars 8 forks source link

Unreliable test #5

Open hiqsol opened 5 years ago

hiqsol commented 5 years ago

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.

fcaldarelli commented 5 years ago

Why are there tests that depend from testSend() ?

https://github.com/yiisoft/yii-http-client/blob/0baac8a3973a95a357268b1309128e8b28879e6e/tests/unit/TransportTestCase.php#L96

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

machour commented 5 years ago

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.