aboutsummaryrefslogtreecommitdiff
path: root/engine/tests/api
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-12 20:08:44 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-12 20:08:44 +0000
commitd4cab20408bcfa394ca978a16e09e6fd84539350 (patch)
tree1742a815ff4d19adc652f2a00e121e6c27a3472c /engine/tests/api
parent78f023b3b149e1f1c8c9428162e3b6551145b9e1 (diff)
downloadelgg-d4cab20408bcfa394ca978a16e09e6fd84539350.tar.gz
elgg-d4cab20408bcfa394ca978a16e09e6fd84539350.tar.bz2
Refs #3091 rewrote the js and css register functions to require a name
git-svn-id: http://code.elgg.org/elgg/trunk@8668 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/tests/api')
-rw-r--r--engine/tests/api/helpers.php39
1 files changed, 12 insertions, 27 deletions
diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php
index 488fd8390..b8cf96900 100644
--- a/engine/tests/api/helpers.php
+++ b/engine/tests/api/helpers.php
@@ -103,15 +103,10 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
public function testElggRegisterJS() {
global $CONFIG;
- // specify id
- $result = elgg_register_js('//test1.com', 'key', 'footer');
+ // specify name
+ $result = elgg_register_js('key', '//test1.com', 'footer');
$this->assertTrue($result);
- $this->assertIdentical('//test1.com', $CONFIG->externals['javascript']['footer']['key']);
-
- // let Elgg pick id
- $result = elgg_register_js('//test2.com');
- $this->assertTrue($result);
- $this->assertIdentical('//test2.com', $CONFIG->externals['javascript']['head'][0]);
+ $this->assertIdentical('//test1.com', $CONFIG->externals['js']['footer']['key']);
// send a bad url
$result = elgg_register_js();
@@ -124,19 +119,10 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
public function testElggRegisterCSS() {
global $CONFIG;
- // specify id
- $result = elgg_register_css('//test1.com', 'key');
+ // specify name
+ $result = elgg_register_css('key', '//test1.com');
$this->assertTrue($result);
$this->assertIdentical('//test1.com', $CONFIG->externals['css']['head']['key']);
-
- // let Elgg pick id
- $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);
}
/**
@@ -147,23 +133,20 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$urls = array('id1' => '//url1.com', 'id2' => '//url2.com', 'id3' => '//url3.com');
foreach ($urls as $id => $url) {
- elgg_register_js($url, $id);
+ elgg_register_js($id, $url);
}
$result = elgg_unregister_js('id1');
$this->assertTrue($result);
- $this->assertNULL($CONFIG->externals['javascript']['head']['id1']);
-
- $result = elgg_unregister_js('', '//url2.com');
- $this->assertTrue($result);
- $this->assertNULL($CONFIG->externals['javascript']['head']['id2']);
+ $this->assertNULL($CONFIG->externals['js']['head']['id1']);
$result = elgg_unregister_js('id1');
$this->assertFalse($result);
$result = elgg_unregister_js('', '//url2.com');
$this->assertFalse($result);
- $this->assertIdentical($urls['id3'], $CONFIG->externals['javascript']['head']['id3']);
+ $result = elgg_unregister_js('id2');
+ $this->assertIdentical($urls['id3'], $CONFIG->externals['js']['head']['id3']);
}
/**
@@ -172,7 +155,9 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
public function testElggGetJS() {
global $CONFIG;
- $urls = array('id1' => '//url1.com', 'id2' => '//url2.com', 'id3' => '//url3.com');
+ $base = trim(elgg_get_site_url(), "/");
+
+ $urls = array('id1' => "$base/id1", 'id2' => "$base/id2", 'id3' => "$base/id3");
foreach ($urls as $id => $url) {
elgg_register_js($url, $id);
}