Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4133767
NullMultiHttpClient.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
781 B
Referenced Files
None
Subscribers
None
NullMultiHttpClient.php
View Options
<?php
use
PHPUnit\Framework\Assert
;
use
PHPUnit\Framework\AssertionFailedError
;
use
Wikimedia\Http\MultiHttpClient
;
/**
* A simple {@link MultiHttpClient} implementation that can be used to prevent
* HTTP requests in tests. All attempts to execute a request will fail.
*
* Use MockHttpTrait for controlling responses to mock HTTP requests.
*
* @author Daniel Kinzler
* @license GPL-2.0-or-later
*/
class
NullMultiHttpClient
extends
MultiHttpClient
{
/**
* Always fails.
*
* @param array $reqs
* @param array $opts
*
* @throws AssertionFailedError always
*/
public
function
runMulti
(
array
$reqs
,
array
$opts
=
[]
)
{
$urls
=
implode
(
', '
,
array_column
(
$reqs
,
'url'
)
);
Assert
::
fail
(
"HTTP requests to {$urls} blocked. Use MockHttpTrait."
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 12:18 (3 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
eb/79/a130cb521edb3e0ac7bc7946ae72
Default Alt Text
NullMultiHttpClient.php (781 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment