Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / mocks / NullMultiHttpClient.php
blob607d3f77921d3da3c48a10c83abe6f499fbea5a4
1 <?php
3 use PHPUnit\Framework\Assert;
4 use PHPUnit\Framework\AssertionFailedError;
5 use Wikimedia\Http\MultiHttpClient;
7 /**
8 * A simple {@link MultiHttpClient} implementation that can be used to prevent
9 * HTTP requests in tests. All attempts to execute a request will fail.
11 * Use MockHttpTrait for controlling responses to mock HTTP requests.
13 * @author Daniel Kinzler
14 * @license GPL-2.0-or-later
16 class NullMultiHttpClient extends MultiHttpClient {
18 /**
19 * Always fails.
21 * @param array $reqs
22 * @param array $opts
24 * @throws AssertionFailedError always
26 public function runMulti( array $reqs, array $opts = [] ) {
27 $urls = implode( ', ', array_column( $reqs, 'url' ) );
28 Assert::fail( "HTTP requests to {$urls} blocked. Use MockHttpTrait." );