aboutsummaryrefslogtreecommitdiff
path: root/engine/tests/api/helpers.php
diff options
context:
space:
mode:
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-04 20:08:20 +0000
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-04 20:08:20 +0000
commit0630ba0a2b8033d7b0f5953aac6344eee752ba04 (patch)
tree10750b342afc46699f3658f2d952b97e309e9477 /engine/tests/api/helpers.php
parentc9f0d56c2ee4a091a8424bb14a179fa58ddea2c0 (diff)
downloadelgg-0630ba0a2b8033d7b0f5953aac6344eee752ba04.tar.gz
elgg-0630ba0a2b8033d7b0f5953aac6344eee752ba04.tar.bz2
Fixes #2463: Added ^ to beginning of normalize_url regex to prevent matching on urls like mod/plugin/page.php. Added unit tests to verify functionality.
git-svn-id: http://code.elgg.org/elgg/trunk@7236 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/tests/api/helpers.php')
-rw-r--r--engine/tests/api/helpers.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php
index b8c7f048d..8dab74ff8 100644
--- a/engine/tests/api/helpers.php
+++ b/engine/tests/api/helpers.php
@@ -65,6 +65,26 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
}
/**
+ * Test elgg_normalize_url()
+ */
+ public function testElggNormalizeURL() {
+ $conversions = array(
+ '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',
+ );
+
+ foreach ($conversions as $input => $output) {
+ $this->assertIdentical($output, elgg_normalize_url($input));
+ }
+ }
+
+
+ /**
* Test elgg_register_js()
*/
public function testElggRegisterJS() {