3 class ExternalStoreTest
extends MediaWikiIntegrationTestCase
{
6 * @covers \ExternalStore::fetchFromURL
8 public function testExternalFetchFromURL_noExternalStores() {
10 'ExternalStoreFactory',
11 new ExternalStoreFactory( [], [], 'test-id' )
15 ExternalStore
::fetchFromURL( 'ForTesting://cluster1/200' ),
16 'Deny if wgExternalStores is not set to a non-empty array'
20 public static function provideFetchFromURLWithStore() {
21 yield
[ 'Hello', 'ForTesting://cluster1/200', 'Allow ForTesting://cluster1/200' ];
22 yield
[ 'Hello', 'ForTesting://cluster1/300/0', 'Allow ForTesting://cluster1/300/0' ];
25 yield
[ false, 'ftp.example.org', 'Deny domain ftp.example.org' ];
26 yield
[ false, '/example.txt', 'Deny path /example.txt' ];
27 yield
[ false, 'http://', 'Deny protocol http://' ];
31 * @covers \ExternalStore::fetchFromURL
32 * @dataProvider provideFetchFromURLWithStore
34 public function testExternalFetchFromURL_someExternalStore( $expect, $url, $msg ) {
36 'ExternalStoreFactory',
37 new ExternalStoreFactory( [ 'ForTesting' ], [ 'ForTesting://cluster1' ], 'test-id' )
40 $this->assertSame( $expect, ExternalStore
::fetchFromURL( $url ), $msg );