aboutsummaryrefslogtreecommitdiff
path: root/engine/tests/api/helpers.php
diff options
context:
space:
mode:
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-14 07:20:20 +0000
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-14 07:20:20 +0000
commitbddba2985d89ff3ed9f52681b37cdce7a9c22bd9 (patch)
tree6183b11eb215522a797867d44fe9b1a97f7fea67 /engine/tests/api/helpers.php
parentfbbcb9afa1fd0889213631e0165a53f3e87757a6 (diff)
downloadelgg-bddba2985d89ff3ed9f52681b37cdce7a9c22bd9.tar.gz
elgg-bddba2985d89ff3ed9f52681b37cdce7a9c22bd9.tar.bz2
Added some more unit tests for elgg_normalize_url
git-svn-id: http://code.elgg.org/elgg/trunk@7310 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/tests/api/helpers.php')
-rw-r--r--engine/tests/api/helpers.php38
1 files 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);