Index: trunk/phase3/tests/phpunit/includes/GlobalFunctions/wfExpandUrl.php |
— | — | @@ -0,0 +1,26 @@ |
| 2 | +<?php |
| 3 | +/* |
| 4 | + * To change this template, choose Tools | Templates |
| 5 | + * and open the template in the editor. |
| 6 | + */ |
| 7 | + |
| 8 | +class wfExpandUrl extends MediaWikiTestCase { |
| 9 | + /** @dataProvider provideExpandableUrls */ |
| 10 | + public function testWfExpandUrl( $fullUrl, $shortUrl, $message ) { |
| 11 | + $this->assertEquals( $fullUrl, wfExpandUrl( $shortUrl ), $message ); |
| 12 | + } |
| 13 | + |
| 14 | + /** |
| 15 | + * Provider of URL examples for testing wfExpandUrl() |
| 16 | + */ |
| 17 | + public function provideExpandableUrls() { |
| 18 | + global $wgServer; |
| 19 | + return array( |
| 20 | + array( "$wgServer/wiki/FooBar", '/wiki/FooBar', 'Testing expanding URL beginning with /' ), |
| 21 | + array( 'http://example.com', 'http://example.com', 'Testing fully qualified http URLs (no need to expand)' ), |
| 22 | + array( 'https://example.com', 'https://example.com', 'Testing fully qualified https URLs (no need to expand)' ), |
| 23 | + # Would be nice to support this, see fixme on wfExpandUrl() |
| 24 | + array( "wiki/FooBar", 'wiki/FooBar', "Test non-expandable relative URLs" ), |
| 25 | + ); |
| 26 | + } |
| 27 | +} |
Property changes on: trunk/phase3/tests/phpunit/includes/GlobalFunctions/wfExpandUrl.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 28 | + native |