From: Antoine Musso Date: Sun, 7 Nov 2010 13:07:19 +0000 (+0000) Subject: Tests bad URL handling by ExternalStore::fetchFromURL() X-Git-Tag: 1.31.0-rc.0~34021 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_supprimer.php?a=commitdiff_plain;h=8b9e050202d0445199bee01a4351f60db8d82376;p=lhc%2Fweb%2Fwiklou.git Tests bad URL handling by ExternalStore::fetchFromURL() Follow up r68900 --- diff --git a/maintenance/tests/phpunit/includes/ExternalStoreTest.php b/maintenance/tests/phpunit/includes/ExternalStoreTest.php new file mode 100644 index 0000000000..3c15f69755 --- /dev/null +++ b/maintenance/tests/phpunit/includes/ExternalStoreTest.php @@ -0,0 +1,32 @@ +saved_wgExternalStores = $wgExternalStores ; + } + + function tearDown() { + global $wgExternalStores; + $wgExternalStores = $this->saved_wgExternalStores ; + } + + function testExternalStoreDoesNotFetchIncorrectURL() { + global $wgExternalStores; + $wgExternalStores = true; + + # Assertions for r68900 + $this->assertFalse( + ExternalStore::fetchFromURL( 'http://' ) ); + $this->assertFalse( + ExternalStore::fetchFromURL( 'ftp.wikimedia.org' ) ); + $this->assertFalse( + ExternalStore::fetchFromURL( '/super.txt' ) ); + } +} +