From 4faa55d958509cb298726d1b884beea767886275 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 13 Jul 2011 01:54:40 +0000 Subject: [PATCH] Add some tests for wfExpandUrl. Definitely not complete (needs some for protocol relativeness) --- .../includes/GlobalFunctions/wfExpandUrl.php | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/phpunit/includes/GlobalFunctions/wfExpandUrl.php diff --git a/tests/phpunit/includes/GlobalFunctions/wfExpandUrl.php b/tests/phpunit/includes/GlobalFunctions/wfExpandUrl.php new file mode 100644 index 0000000000..a59fcc032d --- /dev/null +++ b/tests/phpunit/includes/GlobalFunctions/wfExpandUrl.php @@ -0,0 +1,26 @@ +assertEquals( $fullUrl, wfExpandUrl( $shortUrl ), $message ); + } + + /** + * Provider of URL examples for testing wfExpandUrl() + */ + public function provideExpandableUrls() { + global $wgServer; + return array( + array( "$wgServer/wiki/FooBar", '/wiki/FooBar', 'Testing expanding URL beginning with /' ), + array( 'http://example.com', 'http://example.com', 'Testing fully qualified http URLs (no need to expand)' ), + array( 'https://example.com', 'https://example.com', 'Testing fully qualified https URLs (no need to expand)' ), + # Would be nice to support this, see fixme on wfExpandUrl() + array( "wiki/FooBar", 'wiki/FooBar', "Test non-expandable relative URLs" ), + ); + } +} -- 2.20.1