From 8b9e050202d0445199bee01a4351f60db8d82376 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 7 Nov 2010 13:07:19 +0000 Subject: [PATCH] Tests bad URL handling by ExternalStore::fetchFromURL() Follow up r68900 --- .../phpunit/includes/ExternalStoreTest.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 maintenance/tests/phpunit/includes/ExternalStoreTest.php 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' ) ); + } +} + -- 2.20.1