From bddba2985d89ff3ed9f52681b37cdce7a9c22bd9 Mon Sep 17 00:00:00 2001 From: ewinslow Date: Sun, 14 Nov 2010 07:20:20 +0000 Subject: Added some more unit tests for elgg_normalize_url git-svn-id: http://code.elgg.org/elgg/trunk@7310 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/tests/api/helpers.php | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php index 565cf054a..46ff3ac1b 100644 --- a/engine/tests/api/helpers.php +++ b/engine/tests/api/helpers.php @@ -69,30 +69,34 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { */ public function testElggNormalizeURL() { $conversions = array( - 'http://example.com' => 'http://example.com', - 'https://example.com' => 'https://example.com', + 'http://example.com' => 'http://example.com', + 'https://example.com' => 'https://example.com', '//example.com' => '//example.com', - + 'example.com' => 'http://example.com', 'example.com/subpage' => 'http://example.com/subpage', - - 'pg/page/handler' => elgg_get_site_url().'pg/page/handler', - 'mod/plugin/file.php' => elgg_get_site_url().'mod/plugin/file.php', - 'rootfile.php' => elgg_get_site_url().'rootfile.php', - 'rootfile.php?setting=setting' => elgg_get_site_url().'rootfile.php?setting=setting', - - '/pg/page/handler' => elgg_get_site_url().'pg/page/handler', - '/mod/plugin/file.php' => elgg_get_site_url().'mod/plugin/file.php', - '/rootfile.php' => elgg_get_site_url().'rootfile.php', - '/rootfile.php?setting=setting' => elgg_get_site_url().'rootfile.php?setting=setting', + + 'pg/page/handler' => elgg_get_site_url() . 'pg/page/handler', + 'pg/page/handler?p=v&p2=v2' => elgg_get_site_url() . 'pg/page/handler?p=v&p2=v2', + 'mod/plugin/file.php' => elgg_get_site_url() . 'mod/plugin/file.php', + 'mod/plugin/file.php?p=v&p2=v2' => elgg_get_site_url() . 'mod/plugin/file.php?p=v&p2=v2', + 'rootfile.php' => elgg_get_site_url() . 'rootfile.php', + 'rootfile.php?p=v&p2=v2' => elgg_get_site_url() . 'rootfile.php??p=v&p2=v2', + + '/pg/page/handler' => elgg_get_site_url() . 'pg/page/handler', + '/pg/page/handler?p=v&p2=v2' => elgg_get_site_url() . 'pg/page/handler?p=v&p2=v2', + '/mod/plugin/file.php' => elgg_get_site_url() . 'mod/plugin/file.php', + '/mod/plugin/file.php?p=v&p2=v2' => elgg_get_site_url() . 'mod/plugin/file.php?p=v&p2=v2', + '/rootfile.php' => elgg_get_site_url() . 'rootfile.php', + '/rootfile.php?p=v&p2=v2' => elgg_get_site_url() . 'rootfile.php??p=v&p2=v2', ); - + foreach ($conversions as $input => $output) { $this->assertIdentical($output, elgg_normalize_url($input)); } } - - + + /** * Test elgg_register_js() */ @@ -129,7 +133,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { $result = elgg_register_css('//test2.com'); $this->assertTrue($result); $this->assertIdentical('//test2.com', $CONFIG->externals['css']['head'][1]); - + // send a bad url $result = elgg_register_js(); $this->assertFalse($result); -- cgit v1.2.3