MediaWiki  1.23.1
wfParseUrlTest.php
Go to the documentation of this file.
1 <?php
27  protected function setUp() {
28  parent::setUp();
29 
30  $this->setMwGlobals( 'wgUrlProtocols', array(
31  '//', 'http://', 'file://', 'mailto:',
32  ) );
33  }
34 
38  public function testWfParseUrl( $url, $parts ) {
39  $partsDump = var_export( $parts, true );
40  $this->assertEquals(
41  $parts,
42  wfParseUrl( $url ),
43  "Testing $url parses to $partsDump"
44  );
45  }
46 
52  public static function provideURLs() {
53  return array(
54  array(
55  '//example.org',
56  array(
57  'scheme' => '',
58  'delimiter' => '//',
59  'host' => 'example.org',
60  )
61  ),
62  array(
63  'http://example.org',
64  array(
65  'scheme' => 'http',
66  'delimiter' => '://',
67  'host' => 'example.org',
68  )
69  ),
70  array(
71  'http://id:key@example.org:123/path?foo=bar#baz',
72  array(
73  'scheme' => 'http',
74  'delimiter' => '://',
75  'user' => 'id',
76  'pass' => 'key',
77  'host' => 'example.org',
78  'port' => 123,
79  'path' => '/path',
80  'query' => 'foo=bar',
81  'fragment' => 'baz',
82  )
83  ),
84  array(
85  'file://example.org/etc/php.ini',
86  array(
87  'scheme' => 'file',
88  'delimiter' => '://',
89  'host' => 'example.org',
90  'path' => '/etc/php.ini',
91  )
92  ),
93  array(
94  'file:///etc/php.ini',
95  array(
96  'scheme' => 'file',
97  'delimiter' => '://',
98  'host' => '',
99  'path' => '/etc/php.ini',
100  )
101  ),
102  array(
103  'file:///c:/',
104  array(
105  'scheme' => 'file',
106  'delimiter' => '://',
107  'host' => '',
108  'path' => '/c:/',
109  )
110  ),
111  array(
112  'mailto:id@example.org',
113  array(
114  'scheme' => 'mailto',
115  'delimiter' => ':',
116  'host' => 'id@example.org',
117  'path' => '',
118  )
119  ),
120  array(
121  'mailto:id@example.org?subject=Foo',
122  array(
123  'scheme' => 'mailto',
124  'delimiter' => ':',
125  'host' => 'id@example.org',
126  'path' => '',
127  'query' => 'subject=Foo',
128  )
129  ),
130  array(
131  'mailto:?subject=Foo',
132  array(
133  'scheme' => 'mailto',
134  'delimiter' => ':',
135  'host' => '',
136  'path' => '',
137  'query' => 'subject=Foo',
138  )
139  ),
140  array(
141  'invalid://test/',
142  false
143  ),
144  );
145  }
146 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
WfParseUrlTest\provideURLs
static provideURLs()
Provider of URLs for testing wfParseUrl()
Definition: wfParseUrlTest.php:52
WfParseUrlTest\testWfParseUrl
testWfParseUrl( $url, $parts)
@dataProvider provideURLs
Definition: wfParseUrlTest.php:38
wfParseUrl
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
Definition: GlobalFunctions.php:755
MediaWikiTestCase\setMwGlobals
setMwGlobals( $pairs, $value=null)
Definition: MediaWikiTestCase.php:302
MediaWikiTestCase
Definition: MediaWikiTestCase.php:6
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
WfParseUrlTest
@covers wfParseUrl
Definition: wfParseUrlTest.php:26
WfParseUrlTest\setUp
setUp()
Definition: wfParseUrlTest.php:27