url_test.php 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. <?php
  2. // $Id: url_test.php 1780 2008-04-21 18:57:46Z edwardzyang $
  3. require_once(dirname(__FILE__) . '/../autorun.php');
  4. require_once(dirname(__FILE__) . '/../url.php');
  5. class TestOfUrl extends UnitTestCase {
  6. function testDefaultUrl() {
  7. $url = new SimpleUrl('');
  8. $this->assertEqual($url->getScheme(), '');
  9. $this->assertEqual($url->getHost(), '');
  10. $this->assertEqual($url->getScheme('http'), 'http');
  11. $this->assertEqual($url->getHost('localhost'), 'localhost');
  12. $this->assertEqual($url->getPath(), '');
  13. }
  14. function testBasicParsing() {
  15. $url = new SimpleUrl('https://www.lastcraft.com/test/');
  16. $this->assertEqual($url->getScheme(), 'https');
  17. $this->assertEqual($url->getHost(), 'www.lastcraft.com');
  18. $this->assertEqual($url->getPath(), '/test/');
  19. }
  20. function testRelativeUrls() {
  21. $url = new SimpleUrl('../somewhere.php');
  22. $this->assertEqual($url->getScheme(), false);
  23. $this->assertEqual($url->getHost(), false);
  24. $this->assertEqual($url->getPath(), '../somewhere.php');
  25. }
  26. function testParseBareParameter() {
  27. $url = new SimpleUrl('?a');
  28. $this->assertEqual($url->getPath(), '');
  29. $this->assertEqual($url->getEncodedRequest(), '?a');
  30. $url->addRequestParameter('x', 'X');
  31. $this->assertEqual($url->getEncodedRequest(), '?a=&x=X');
  32. }
  33. function testParseEmptyParameter() {
  34. $url = new SimpleUrl('?a=');
  35. $this->assertEqual($url->getPath(), '');
  36. $this->assertEqual($url->getEncodedRequest(), '?a=');
  37. $url->addRequestParameter('x', 'X');
  38. $this->assertEqual($url->getEncodedRequest(), '?a=&x=X');
  39. }
  40. function testParseParameterPair() {
  41. $url = new SimpleUrl('?a=A');
  42. $this->assertEqual($url->getPath(), '');
  43. $this->assertEqual($url->getEncodedRequest(), '?a=A');
  44. $url->addRequestParameter('x', 'X');
  45. $this->assertEqual($url->getEncodedRequest(), '?a=A&x=X');
  46. }
  47. function testParseMultipleParameters() {
  48. $url = new SimpleUrl('?a=A&b=B');
  49. $this->assertEqual($url->getEncodedRequest(), '?a=A&b=B');
  50. $url->addRequestParameter('x', 'X');
  51. $this->assertEqual($url->getEncodedRequest(), '?a=A&b=B&x=X');
  52. }
  53. function testParsingParameterMixture() {
  54. $url = new SimpleUrl('?a=A&b=&c');
  55. $this->assertEqual($url->getEncodedRequest(), '?a=A&b=&c');
  56. $url->addRequestParameter('x', 'X');
  57. $this->assertEqual($url->getEncodedRequest(), '?a=A&b=&c=&x=X');
  58. }
  59. function testAddParametersFromScratch() {
  60. $url = new SimpleUrl('');
  61. $url->addRequestParameter('a', 'A');
  62. $this->assertEqual($url->getEncodedRequest(), '?a=A');
  63. $url->addRequestParameter('b', 'B');
  64. $this->assertEqual($url->getEncodedRequest(), '?a=A&b=B');
  65. $url->addRequestParameter('a', 'aaa');
  66. $this->assertEqual($url->getEncodedRequest(), '?a=A&b=B&a=aaa');
  67. }
  68. function testClearingParameters() {
  69. $url = new SimpleUrl('');
  70. $url->addRequestParameter('a', 'A');
  71. $url->clearRequest();
  72. $this->assertIdentical($url->getEncodedRequest(), '');
  73. }
  74. function testEncodingParameters() {
  75. $url = new SimpleUrl('');
  76. $url->addRequestParameter('a', '?!"\'#~@[]{}:;<>,./|£$%^&*()_+-=');
  77. $this->assertIdentical(
  78. $request = $url->getEncodedRequest(),
  79. '?a=%3F%21%22%27%23%7E%40%5B%5D%7B%7D%3A%3B%3C%3E%2C.%2F%7C%A3%24%25%5E%26%2A%28%29_%2B-%3D');
  80. }
  81. function testDecodingParameters() {
  82. $url = new SimpleUrl('?a=%3F%21%22%27%23%7E%40%5B%5D%7B%7D%3A%3B%3C%3E%2C.%2F%7C%A3%24%25%5E%26%2A%28%29_%2B-%3D');
  83. $this->assertEqual(
  84. $url->getEncodedRequest(),
  85. '?a=' . urlencode('?!"\'#~@[]{}:;<>,./|£$%^&*()_+-='));
  86. }
  87. function testUrlInQueryDoesNotConfuseParsing() {
  88. $url = new SimpleUrl('wibble/login.php?url=http://www.google.com/moo/');
  89. $this->assertFalse($url->getScheme());
  90. $this->assertFalse($url->getHost());
  91. $this->assertEqual($url->getPath(), 'wibble/login.php');
  92. $this->assertEqual($url->getEncodedRequest(), '?url=http://www.google.com/moo/');
  93. }
  94. function testSettingCordinates() {
  95. $url = new SimpleUrl('');
  96. $url->setCoordinates('32', '45');
  97. $this->assertIdentical($url->getX(), 32);
  98. $this->assertIdentical($url->getY(), 45);
  99. $this->assertEqual($url->getEncodedRequest(), '');
  100. }
  101. function testParseCordinates() {
  102. $url = new SimpleUrl('?32,45');
  103. $this->assertIdentical($url->getX(), 32);
  104. $this->assertIdentical($url->getY(), 45);
  105. }
  106. function testClearingCordinates() {
  107. $url = new SimpleUrl('?32,45');
  108. $url->setCoordinates();
  109. $this->assertIdentical($url->getX(), false);
  110. $this->assertIdentical($url->getY(), false);
  111. }
  112. function testParsingParameterCordinateMixture() {
  113. $url = new SimpleUrl('?a=A&b=&c?32,45');
  114. $this->assertIdentical($url->getX(), 32);
  115. $this->assertIdentical($url->getY(), 45);
  116. $this->assertEqual($url->getEncodedRequest(), '?a=A&b=&c');
  117. }
  118. function testParsingParameterWithBadCordinates() {
  119. $url = new SimpleUrl('?a=A&b=&c?32');
  120. $this->assertIdentical($url->getX(), false);
  121. $this->assertIdentical($url->getY(), false);
  122. $this->assertEqual($url->getEncodedRequest(), '?a=A&b=&c?32');
  123. }
  124. function testPageSplitting() {
  125. $url = new SimpleUrl('./here/../there/somewhere.php');
  126. $this->assertEqual($url->getPath(), './here/../there/somewhere.php');
  127. $this->assertEqual($url->getPage(), 'somewhere.php');
  128. $this->assertEqual($url->getBasePath(), './here/../there/');
  129. }
  130. function testAbsolutePathPageSplitting() {
  131. $url = new SimpleUrl("http://host.com/here/there/somewhere.php");
  132. $this->assertEqual($url->getPath(), "/here/there/somewhere.php");
  133. $this->assertEqual($url->getPage(), "somewhere.php");
  134. $this->assertEqual($url->getBasePath(), "/here/there/");
  135. }
  136. function testSplittingUrlWithNoPageGivesEmptyPage() {
  137. $url = new SimpleUrl('/here/there/');
  138. $this->assertEqual($url->getPath(), '/here/there/');
  139. $this->assertEqual($url->getPage(), '');
  140. $this->assertEqual($url->getBasePath(), '/here/there/');
  141. }
  142. function testPathNormalisation() {
  143. $url = new SimpleUrl();
  144. $this->assertEqual(
  145. $url->normalisePath('https://host.com/I/am/here/../there/somewhere.php'),
  146. 'https://host.com/I/am/there/somewhere.php');
  147. }
  148. // regression test for #1535407
  149. function testPathNormalisationWithSinglePeriod() {
  150. $url = new SimpleUrl();
  151. $this->assertEqual(
  152. $url->normalisePath('https://host.com/I/am/here/./../there/somewhere.php'),
  153. 'https://host.com/I/am/there/somewhere.php');
  154. }
  155. // regression test for #1852413
  156. function testHostnameExtractedFromUContainingAtSign() {
  157. $url = new SimpleUrl("http://localhost/name@example.com");
  158. $this->assertEqual($url->getScheme(), "http");
  159. $this->assertEqual($url->getUsername(), "");
  160. $this->assertEqual($url->getPassword(), "");
  161. $this->assertEqual($url->getHost(), "localhost");
  162. $this->assertEqual($url->getPath(), "/name@example.com");
  163. }
  164. function testHostnameInLocalhost() {
  165. $url = new SimpleUrl("http://localhost/name/example.com");
  166. $this->assertEqual($url->getScheme(), "http");
  167. $this->assertEqual($url->getUsername(), "");
  168. $this->assertEqual($url->getPassword(), "");
  169. $this->assertEqual($url->getHost(), "localhost");
  170. $this->assertEqual($url->getPath(), "/name/example.com");
  171. }
  172. function testUsernameAndPasswordAreUrlDecoded() {
  173. $url = new SimpleUrl('http://' . urlencode('test@test') .
  174. ':' . urlencode('$!£@*&%') . '@www.lastcraft.com');
  175. $this->assertEqual($url->getUsername(), 'test@test');
  176. $this->assertEqual($url->getPassword(), '$!£@*&%');
  177. }
  178. function testBlitz() {
  179. $this->assertUrl(
  180. "https://username:password@www.somewhere.com:243/this/that/here.php?a=1&b=2#anchor",
  181. array("https", "username", "password", "www.somewhere.com", 243, "/this/that/here.php", "com", "?a=1&b=2", "anchor"),
  182. array("a" => "1", "b" => "2"));
  183. $this->assertUrl(
  184. "username:password@www.somewhere.com/this/that/here.php?a=1",
  185. array(false, "username", "password", "www.somewhere.com", false, "/this/that/here.php", "com", "?a=1", false),
  186. array("a" => "1"));
  187. $this->assertUrl(
  188. "username:password@somewhere.com:243?1,2",
  189. array(false, "username", "password", "somewhere.com", 243, "/", "com", "", false),
  190. array(),
  191. array(1, 2));
  192. $this->assertUrl(
  193. "https://www.somewhere.com",
  194. array("https", false, false, "www.somewhere.com", false, "/", "com", "", false));
  195. $this->assertUrl(
  196. "username@www.somewhere.com:243#anchor",
  197. array(false, "username", false, "www.somewhere.com", 243, "/", "com", "", "anchor"));
  198. $this->assertUrl(
  199. "/this/that/here.php?a=1&b=2?3,4",
  200. array(false, false, false, false, false, "/this/that/here.php", false, "?a=1&b=2", false),
  201. array("a" => "1", "b" => "2"),
  202. array(3, 4));
  203. $this->assertUrl(
  204. "username@/here.php?a=1&b=2",
  205. array(false, "username", false, false, false, "/here.php", false, "?a=1&b=2", false),
  206. array("a" => "1", "b" => "2"));
  207. }
  208. function testAmbiguousHosts() {
  209. $this->assertUrl(
  210. "tigger",
  211. array(false, false, false, false, false, "tigger", false, "", false));
  212. $this->assertUrl(
  213. "/tigger",
  214. array(false, false, false, false, false, "/tigger", false, "", false));
  215. $this->assertUrl(
  216. "//tigger",
  217. array(false, false, false, "tigger", false, "/", false, "", false));
  218. $this->assertUrl(
  219. "//tigger/",
  220. array(false, false, false, "tigger", false, "/", false, "", false));
  221. $this->assertUrl(
  222. "tigger.com",
  223. array(false, false, false, "tigger.com", false, "/", "com", "", false));
  224. $this->assertUrl(
  225. "me.net/tigger",
  226. array(false, false, false, "me.net", false, "/tigger", "net", "", false));
  227. }
  228. function testAsString() {
  229. $this->assertPreserved('https://www.here.com');
  230. $this->assertPreserved('http://me:secret@www.here.com');
  231. $this->assertPreserved('http://here/there');
  232. $this->assertPreserved('http://here/there?a=A&b=B');
  233. $this->assertPreserved('http://here/there?a=1&a=2');
  234. $this->assertPreserved('http://here/there?a=1&a=2?9,8');
  235. $this->assertPreserved('http://host?a=1&a=2');
  236. $this->assertPreserved('http://host#stuff');
  237. $this->assertPreserved('http://me:secret@www.here.com/a/b/c/here.html?a=A?7,6');
  238. $this->assertPreserved('http://www.here.com/?a=A__b=B');
  239. $this->assertPreserved('http://www.example.com:8080/');
  240. }
  241. function assertUrl($raw, $parts, $params = false, $coords = false) {
  242. if (! is_array($params)) {
  243. $params = array();
  244. }
  245. $url = new SimpleUrl($raw);
  246. $this->assertIdentical($url->getScheme(), $parts[0], "[$raw] scheme -> %s");
  247. $this->assertIdentical($url->getUsername(), $parts[1], "[$raw] username -> %s");
  248. $this->assertIdentical($url->getPassword(), $parts[2], "[$raw] password -> %s");
  249. $this->assertIdentical($url->getHost(), $parts[3], "[$raw] host -> %s");
  250. $this->assertIdentical($url->getPort(), $parts[4], "[$raw] port -> %s");
  251. $this->assertIdentical($url->getPath(), $parts[5], "[$raw] path -> %s");
  252. $this->assertIdentical($url->getTld(), $parts[6], "[$raw] tld -> %s");
  253. $this->assertIdentical($url->getEncodedRequest(), $parts[7], "[$raw] encoded -> %s");
  254. $this->assertIdentical($url->getFragment(), $parts[8], "[$raw] fragment -> %s");
  255. if ($coords) {
  256. $this->assertIdentical($url->getX(), $coords[0], "[$raw] x -> %s");
  257. $this->assertIdentical($url->getY(), $coords[1], "[$raw] y -> %s");
  258. }
  259. }
  260. function testUrlWithTwoSlashesInPath() {
  261. $url = new SimpleUrl('/article/categoryedit/insert//');
  262. $this->assertEqual($url->getPath(), '/article/categoryedit/insert//');
  263. }
  264. function assertPreserved($string) {
  265. $url = new SimpleUrl($string);
  266. $this->assertEqual($url->asString(), $string);
  267. }
  268. }
  269. class TestOfAbsoluteUrls extends UnitTestCase {
  270. function testDirectoriesAfterFilename() {
  271. $string = '../../index.php/foo/bar';
  272. $url = new SimpleUrl($string);
  273. $this->assertEqual($url->asString(), $string);
  274. $absolute = $url->makeAbsolute('http://www.domain.com/some/path/');
  275. $this->assertEqual($absolute->asString(), 'http://www.domain.com/index.php/foo/bar');
  276. }
  277. function testMakingAbsolute() {
  278. $url = new SimpleUrl('../there/somewhere.php');
  279. $this->assertEqual($url->getPath(), '../there/somewhere.php');
  280. $absolute = $url->makeAbsolute('https://host.com:1234/I/am/here/');
  281. $this->assertEqual($absolute->getScheme(), 'https');
  282. $this->assertEqual($absolute->getHost(), 'host.com');
  283. $this->assertEqual($absolute->getPort(), 1234);
  284. $this->assertEqual($absolute->getPath(), '/I/am/there/somewhere.php');
  285. }
  286. function testMakingAnEmptyUrlAbsolute() {
  287. $url = new SimpleUrl('');
  288. $this->assertEqual($url->getPath(), '');
  289. $absolute = $url->makeAbsolute('http://host.com/I/am/here/page.html');
  290. $this->assertEqual($absolute->getScheme(), 'http');
  291. $this->assertEqual($absolute->getHost(), 'host.com');
  292. $this->assertEqual($absolute->getPath(), '/I/am/here/page.html');
  293. }
  294. function testMakingAnEmptyUrlAbsoluteWithMissingPageName() {
  295. $url = new SimpleUrl('');
  296. $this->assertEqual($url->getPath(), '');
  297. $absolute = $url->makeAbsolute('http://host.com/I/am/here/');
  298. $this->assertEqual($absolute->getScheme(), 'http');
  299. $this->assertEqual($absolute->getHost(), 'host.com');
  300. $this->assertEqual($absolute->getPath(), '/I/am/here/');
  301. }
  302. function testMakingAShortQueryUrlAbsolute() {
  303. $url = new SimpleUrl('?a#b');
  304. $this->assertEqual($url->getPath(), '');
  305. $absolute = $url->makeAbsolute('http://host.com/I/am/here/');
  306. $this->assertEqual($absolute->getScheme(), 'http');
  307. $this->assertEqual($absolute->getHost(), 'host.com');
  308. $this->assertEqual($absolute->getPath(), '/I/am/here/');
  309. $this->assertEqual($absolute->getEncodedRequest(), '?a');
  310. $this->assertEqual($absolute->getFragment(), 'b');
  311. }
  312. function testMakingADirectoryUrlAbsolute() {
  313. $url = new SimpleUrl('hello/');
  314. $this->assertEqual($url->getPath(), 'hello/');
  315. $this->assertEqual($url->getBasePath(), 'hello/');
  316. $this->assertEqual($url->getPage(), '');
  317. $absolute = $url->makeAbsolute('http://host.com/I/am/here/page.html');
  318. $this->assertEqual($absolute->getPath(), '/I/am/here/hello/');
  319. }
  320. function testMakingARootUrlAbsolute() {
  321. $url = new SimpleUrl('/');
  322. $this->assertEqual($url->getPath(), '/');
  323. $absolute = $url->makeAbsolute('http://host.com/I/am/here/page.html');
  324. $this->assertEqual($absolute->getPath(), '/');
  325. }
  326. function testMakingARootPageUrlAbsolute() {
  327. $url = new SimpleUrl('/here.html');
  328. $absolute = $url->makeAbsolute('http://host.com/I/am/here/page.html');
  329. $this->assertEqual($absolute->getPath(), '/here.html');
  330. }
  331. function testCarryAuthenticationFromRootPage() {
  332. $url = new SimpleUrl('here.html');
  333. $absolute = $url->makeAbsolute('http://test:secret@host.com/');
  334. $this->assertEqual($absolute->getPath(), '/here.html');
  335. $this->assertEqual($absolute->getUsername(), 'test');
  336. $this->assertEqual($absolute->getPassword(), 'secret');
  337. }
  338. function testMakingCoordinateUrlAbsolute() {
  339. $url = new SimpleUrl('?1,2');
  340. $this->assertEqual($url->getPath(), '');
  341. $absolute = $url->makeAbsolute('http://host.com/I/am/here/');
  342. $this->assertEqual($absolute->getScheme(), 'http');
  343. $this->assertEqual($absolute->getHost(), 'host.com');
  344. $this->assertEqual($absolute->getPath(), '/I/am/here/');
  345. $this->assertEqual($absolute->getX(), 1);
  346. $this->assertEqual($absolute->getY(), 2);
  347. }
  348. function testMakingAbsoluteAppendedPath() {
  349. $url = new SimpleUrl('./there/somewhere.php');
  350. $absolute = $url->makeAbsolute('https://host.com/here/');
  351. $this->assertEqual($absolute->getPath(), '/here/there/somewhere.php');
  352. }
  353. function testMakingAbsoluteBadlyFormedAppendedPath() {
  354. $url = new SimpleUrl('there/somewhere.php');
  355. $absolute = $url->makeAbsolute('https://host.com/here/');
  356. $this->assertEqual($absolute->getPath(), '/here/there/somewhere.php');
  357. }
  358. function testMakingAbsoluteHasNoEffectWhenAlreadyAbsolute() {
  359. $url = new SimpleUrl('https://test:secret@www.lastcraft.com:321/stuff/?a=1#f');
  360. $absolute = $url->makeAbsolute('http://host.com/here/');
  361. $this->assertEqual($absolute->getScheme(), 'https');
  362. $this->assertEqual($absolute->getUsername(), 'test');
  363. $this->assertEqual($absolute->getPassword(), 'secret');
  364. $this->assertEqual($absolute->getHost(), 'www.lastcraft.com');
  365. $this->assertEqual($absolute->getPort(), 321);
  366. $this->assertEqual($absolute->getPath(), '/stuff/');
  367. $this->assertEqual($absolute->getEncodedRequest(), '?a=1');
  368. $this->assertEqual($absolute->getFragment(), 'f');
  369. }
  370. function testMakingAbsoluteCarriesAuthenticationWhenAlreadyAbsolute() {
  371. $url = new SimpleUrl('https://www.lastcraft.com');
  372. $absolute = $url->makeAbsolute('http://test:secret@host.com/here/');
  373. $this->assertEqual($absolute->getHost(), 'www.lastcraft.com');
  374. $this->assertEqual($absolute->getUsername(), 'test');
  375. $this->assertEqual($absolute->getPassword(), 'secret');
  376. }
  377. function testMakingHostOnlyAbsoluteDoesNotCarryAnyOtherInformation() {
  378. $url = new SimpleUrl('http://www.lastcraft.com');
  379. $absolute = $url->makeAbsolute('https://host.com:81/here/');
  380. $this->assertEqual($absolute->getScheme(), 'http');
  381. $this->assertEqual($absolute->getHost(), 'www.lastcraft.com');
  382. $this->assertIdentical($absolute->getPort(), false);
  383. $this->assertEqual($absolute->getPath(), '/');
  384. }
  385. }
  386. class TestOfFrameUrl extends UnitTestCase {
  387. function testTargetAttachment() {
  388. $url = new SimpleUrl('http://www.site.com/home.html');
  389. $this->assertIdentical($url->getTarget(), false);
  390. $url->setTarget('A frame');
  391. $this->assertIdentical($url->getTarget(), 'A frame');
  392. }
  393. }
  394. /**
  395. * @note Based off of http://www.mozilla.org/quality/networking/testing/filetests.html
  396. */
  397. class TestOfFileUrl extends UnitTestCase {
  398. function testMinimalUrl() {
  399. $url = new SimpleUrl('file:///');
  400. $this->assertEqual($url->getScheme(), 'file');
  401. $this->assertIdentical($url->getHost(), false);
  402. $this->assertEqual($url->getPath(), '/');
  403. }
  404. function testUnixUrl() {
  405. $url = new SimpleUrl('file:///fileInRoot');
  406. $this->assertEqual($url->getScheme(), 'file');
  407. $this->assertIdentical($url->getHost(), false);
  408. $this->assertEqual($url->getPath(), '/fileInRoot');
  409. }
  410. function testDOSVolumeUrl() {
  411. $url = new SimpleUrl('file:///C:/config.sys');
  412. $this->assertEqual($url->getScheme(), 'file');
  413. $this->assertIdentical($url->getHost(), false);
  414. $this->assertEqual($url->getPath(), '/C:/config.sys');
  415. }
  416. function testDOSVolumePromotion() {
  417. $url = new SimpleUrl('file://C:/config.sys');
  418. $this->assertEqual($url->getScheme(), 'file');
  419. $this->assertIdentical($url->getHost(), false);
  420. $this->assertEqual($url->getPath(), '/C:/config.sys');
  421. }
  422. function testDOSBackslashes() {
  423. $url = new SimpleUrl('file:///C:\config.sys');
  424. $this->assertEqual($url->getScheme(), 'file');
  425. $this->assertIdentical($url->getHost(), false);
  426. $this->assertEqual($url->getPath(), '/C:/config.sys');
  427. }
  428. function testDOSDirnameAfterFile() {
  429. $url = new SimpleUrl('file://C:\config.sys');
  430. $this->assertEqual($url->getScheme(), 'file');
  431. $this->assertIdentical($url->getHost(), false);
  432. $this->assertEqual($url->getPath(), '/C:/config.sys');
  433. }
  434. }
  435. ?>