Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F2750828
ExternalStoreTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ExternalStoreTest.php
View Options
<?php
class
ExternalStoreTest
extends
MediaWikiIntegrationTestCase
{
/**
* @covers \ExternalStore::fetchFromURL
*/
public
function
testExternalFetchFromURL_noExternalStores
()
{
$this
->
setService
(
'ExternalStoreFactory'
,
new
ExternalStoreFactory
(
[],
[],
'test-id'
)
);
$this
->
assertFalse
(
ExternalStore
::
fetchFromURL
(
'ForTesting://cluster1/200'
),
'Deny if wgExternalStores is not set to a non-empty array'
);
}
public
static
function
provideFetchFromURLWithStore
()
{
yield
[
'Hello'
,
'ForTesting://cluster1/200'
,
'Allow ForTesting://cluster1/200'
];
yield
[
'Hello'
,
'ForTesting://cluster1/300/0'
,
'Allow ForTesting://cluster1/300/0'
];
// cases for r68900
yield
[
false
,
'ftp.example.org'
,
'Deny domain ftp.example.org'
];
yield
[
false
,
'/example.txt'
,
'Deny path /example.txt'
];
yield
[
false
,
'http://'
,
'Deny protocol http://'
];
}
/**
* @covers \ExternalStore::fetchFromURL
* @dataProvider provideFetchFromURLWithStore
*/
public
function
testExternalFetchFromURL_someExternalStore
(
$expect
,
$url
,
$msg
)
{
$this
->
setService
(
'ExternalStoreFactory'
,
new
ExternalStoreFactory
(
[
'ForTesting'
],
[
'ForTesting://cluster1'
],
'test-id'
)
);
$this
->
assertSame
(
$expect
,
ExternalStore
::
fetchFromURL
(
$url
),
$msg
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Jul 3, 17:13 (18 h, 54 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e2/8b/cd6708f674cadebce065336dfd55
Default Alt Text
ExternalStoreTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment