The signatures of these methods will change in PHPUnit 9, and in
general, having these methods means additional code to maintain. Since
this is test code, any attempt to use these traits from a class which
doesn't have the required methods will fail hard, and as such, there's
no reason to have these methods at all.
Also, MockServiceDependenciesTrait was redeclaring fail() as a
non-static method, but it is actually static in the parent class, which
makes tests fail on PHP 8.
Bug: T243600
Change-Id: I78bf1bdd2eb2e09aed27d1b6bff2302e28600703
If we directly pass [ TestCase::class, 'fail' ] as the callback for a
mock method, then the method will be called with whatever arguments the
caller tried to pass to the original method. Those arguments may not be
compatible with TestCase::fail()’s signature, which requires the first
argument to be a string (or absent). Use a custom callback first which
throws away any arguments before calling TestCase::fail().
Bug: T272998
Change-Id: I3514d3d29355a55a5ca10ccc22981e3972347f35
Don’t fail the test immediately when createMultiClient() or
createGuzzleClient() is called – instead, return service instances that
will fail the test as soon as any method is called on them. This is a
bit friendlier for dependency injection.
Bug: T272998
Change-Id: I79f90ef028867920f6a228991eda59ed4aeadb62
Per I1702c11928f8760, tests should fail when trying to make a
HTTP request, unless they have explicitely defined the desired
response.
This patch implements the same behavior for the newly introduced
createGuzzleClient() method.
Bug: T263816
Bug: T262443
Change-Id: Ie3c2efb1387ecc5bc29ff1749cae4bb33e636e9f
MockHttpTrait can be used by tests that need to simulate HTTP requests.
Bug: T262443
Needed-By: I1832cb1858ef4cf42ec34cb7fda509ce5b951c27
Needed-By: I390856b4609635cee22253071f21ce63ff716791
Needed-By: Iff24b55dfaf7a4e02a4c80aaeaf0366de5660ef1
Needed-By: Ia8213725839e4b697c4985060bc35593fea622bc
Change-Id: I8ce17da7315b87b8dd0e502e601b9ac488089456