MediaWiki REL1_31
ExternalStoreTest.php
Go to the documentation of this file.
1<?php
2
4
9 $this->setService(
10 'ExternalStoreFactory',
11 new ExternalStoreFactory( [] )
12 );
13
14 $this->assertFalse(
15 ExternalStore::fetchFromURL( 'ForTesting://cluster1/200' ),
16 'Deny if wgExternalStores is not set to a non-empty array'
17 );
18 }
19
24 $this->setService(
25 'ExternalStoreFactory',
26 new ExternalStoreFactory( [ 'ForTesting' ] )
27 );
28
29 $this->assertEquals(
30 'Hello',
31 ExternalStore::fetchFromURL( 'ForTesting://cluster1/200' ),
32 'Allow FOO://cluster1/200'
33 );
34 $this->assertEquals(
35 'Hello',
36 ExternalStore::fetchFromURL( 'ForTesting://cluster1/300/0' ),
37 'Allow FOO://cluster1/300/0'
38 );
39 # Assertions for r68900
40 $this->assertFalse(
41 ExternalStore::fetchFromURL( 'ftp.example.org' ),
42 'Deny domain ftp.example.org'
43 );
44 $this->assertFalse(
45 ExternalStore::fetchFromURL( '/example.txt' ),
46 'Deny path /example.txt'
47 );
48 $this->assertFalse(
49 ExternalStore::fetchFromURL( 'http://' ),
50 'Deny protocol http://'
51 );
52 }
53}
testExternalFetchFromURL_noExternalStores()
ExternalStore::fetchFromURL.
testExternalFetchFromURL_someExternalStore()
ExternalStore::fetchFromURL.
setService( $name, $object)
Sets a service, maintaining a stashed version of the previous service to be restored in tearDown.