The name change happened some time ago, and I think its about time to start using the name name! (Done with a find and replace) My personal motivation for doing this is that I have started trying out vscode as an IDE for mediawiki development, and right now it doesn't appear to handle php aliases very well or at all. Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?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'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers ExternalStore::fetchFromURL
|
|
*/
|
|
public function testExternalFetchFromURL_someExternalStore() {
|
|
$this->setService(
|
|
'ExternalStoreFactory',
|
|
new ExternalStoreFactory( [ 'ForTesting' ], [ 'ForTesting://cluster1' ], 'test-id' )
|
|
);
|
|
|
|
$this->assertEquals(
|
|
'Hello',
|
|
ExternalStore::fetchFromURL( 'ForTesting://cluster1/200' ),
|
|
'Allow FOO://cluster1/200'
|
|
);
|
|
$this->assertEquals(
|
|
'Hello',
|
|
ExternalStore::fetchFromURL( 'ForTesting://cluster1/300/0' ),
|
|
'Allow FOO://cluster1/300/0'
|
|
);
|
|
# Assertions for r68900
|
|
$this->assertFalse(
|
|
ExternalStore::fetchFromURL( 'ftp.example.org' ),
|
|
'Deny domain ftp.example.org'
|
|
);
|
|
$this->assertFalse(
|
|
ExternalStore::fetchFromURL( '/example.txt' ),
|
|
'Deny path /example.txt'
|
|
);
|
|
$this->assertFalse(
|
|
ExternalStore::fetchFromURL( 'http://' ),
|
|
'Deny protocol http://'
|
|
);
|
|
}
|
|
}
|