aboutsummaryrefslogtreecommitdiff
path: root/engine/tests
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2011-11-18 07:32:27 +0100
committerSem <sembrestels@riseup.net>2011-11-18 07:32:27 +0100
commite53d410129701ea1c9d19529afa493f11b5f5b70 (patch)
treed9963b24bf8932654b4a47e36602c75975e50dba /engine/tests
parent377da25d2965c64941f83baae119fc970ec60982 (diff)
parent08a962c98e2923724f8013d6eaae89101243752a (diff)
downloadelgg-e53d410129701ea1c9d19529afa493f11b5f5b70.tar.gz
elgg-e53d410129701ea1c9d19529afa493f11b5f5b70.tar.bz2
Merge github.com:Elgg/Elgg
Conflicts: engine/lib/input.php
Diffstat (limited to 'engine/tests')
-rw-r--r--engine/tests/api/access_collections.php10
-rw-r--r--engine/tests/api/entity_getter_functions.php11
-rw-r--r--engine/tests/api/helpers.php25
-rw-r--r--engine/tests/api/metadata.php9
-rw-r--r--engine/tests/api/plugins.php33
-rw-r--r--engine/tests/objects/entities.php36
-rw-r--r--engine/tests/objects/sites.php2
-rw-r--r--engine/tests/objects/users.php23
-rw-r--r--engine/tests/regression/trac_bugs.php87
-rw-r--r--engine/tests/suite.php2
-rw-r--r--engine/tests/test_files/plugin_17/manifest.xml4
-rw-r--r--engine/tests/test_files/plugin_18/manifest.xml5
-rw-r--r--engine/tests/ui/submenu.php103
13 files changed, 166 insertions, 184 deletions
diff --git a/engine/tests/api/access_collections.php b/engine/tests/api/access_collections.php
index 1e61c45bb..0c37fa779 100644
--- a/engine/tests/api/access_collections.php
+++ b/engine/tests/api/access_collections.php
@@ -194,7 +194,7 @@ class ElggCoreAccessCollectionsTest extends ElggCoreUnitTest {
return $value;
}
- register_plugin_hook('access:collections:write', 'all', 'test_acl_access_hook');
+ elgg_register_plugin_hook_handler('access:collections:write', 'all', 'test_acl_access_hook');
// enable security since we usually run as admin
$ia = elgg_set_ignore_access(false);
@@ -202,14 +202,16 @@ class ElggCoreAccessCollectionsTest extends ElggCoreUnitTest {
$this->assertTrue($result);
$ia = elgg_set_ignore_access($ia);
- unregister_plugin_hook('access:collections:write', 'all', 'test_acl_access_hook');
+ elgg_unregister_plugin_hook_handler('access:collections:write', 'all', 'test_acl_access_hook');
+
+ delete_access_collection($acl_id);
}
// groups interface
// only runs if the groups plugin is enabled because implementation is split between
// core and the plugin.
public function testCreateDeleteGroupACL() {
- if (!is_plugin_enabled('groups')) {
+ if (!elgg_is_active_plugin('groups')) {
return;
}
@@ -231,7 +233,7 @@ class ElggCoreAccessCollectionsTest extends ElggCoreUnitTest {
}
public function testJoinLeaveGroupACL() {
- if (!is_plugin_enabled('groups')) {
+ if (!elgg_is_active_plugin('groups')) {
return;
}
diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php
index aef7a991e..e7906d3c8 100644
--- a/engine/tests/api/entity_getter_functions.php
+++ b/engine/tests/api/entity_getter_functions.php
@@ -855,7 +855,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
public function testElggApiGettersEntityNoSubtype() {
// create an entity we can later delete.
- // order by time created and limit by 1 should == this entity.
+ // order by guid and limit by 1 should == this entity.
$e = new ElggObject();
$e->save();
@@ -2789,4 +2789,13 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
$this->assertEqual($a_e_map[$a->id], $a->owner_guid);
}
}
+
+ public function testElggGetEntitiesBadWheres() {
+ $options = array(
+ 'container_guid' => 'abc'
+ );
+
+ $entities = elgg_get_entities($options);
+ $this->assertFalse($entities);
+ }
}
diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php
index ee2e64cfe..f48f91faf 100644
--- a/engine/tests/api/helpers.php
+++ b/engine/tests/api/helpers.php
@@ -63,6 +63,8 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$this->assertFalse(elgg_instanceof($bad_entity));
$this->assertFalse(elgg_instanceof($bad_entity, 'object'));
$this->assertFalse(elgg_instanceof($bad_entity, 'object', 'test_subtype'));
+
+ remove_subtype('object', 'test_subtype');
}
/**
@@ -72,7 +74,13 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$conversions = array(
'http://example.com' => 'http://example.com',
'https://example.com' => 'https://example.com',
+ 'http://example-time.com' => 'http://example-time.com',
+
'//example.com' => '//example.com',
+ 'ftp://example.com/file' => 'ftp://example.com/file',
+ 'mailto:brett@elgg.org' => 'mailto:brett@elgg.org',
+ 'javascript:alert("test")' => 'javascript:alert("test")',
+ 'app://endpoint' => 'app://endpoint',
'example.com' => 'http://example.com',
'example.com/subpage' => 'http://example.com/subpage',
@@ -166,7 +174,9 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$this->assertFalse(isset($CONFIG->externals_map['js']['id1']));
foreach ($elements as $element) {
- $this->assertFalse($element->name == 'id1');
+ if (isset($element->name)) {
+ $this->assertFalse($element->name == 'id1');
+ }
}
$result = elgg_unregister_js('id1');
@@ -180,7 +190,9 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$this->assertFalse(isset($CONFIG->externals_map['js']['id2']));
foreach ($elements as $element) {
- $this->assertFalse($element->name == 'id2');
+ if (isset($element->name)) {
+ $this->assertFalse($element->name == 'id2');
+ }
}
$this->assertTrue(isset($CONFIG->externals_map['js']['id3']));
@@ -204,7 +216,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$this->assertTrue($result);
$js_urls = elgg_get_loaded_js('footer');
- $this->assertIdentical(array('http://test1.com'), $js_urls);
+ $this->assertIdentical(array(500 => 'http://test1.com'), $js_urls);
}
/**
@@ -227,9 +239,10 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
}
$js_urls = elgg_get_loaded_js('head');
- $this->assertIdentical($js_urls[0], $urls['id1']);
- $this->assertIdentical($js_urls[1], $urls['id2']);
- $this->assertIdentical($js_urls[2], $urls['id3']);
+
+ $this->assertIdentical($js_urls[500], $urls['id1']);
+ $this->assertIdentical($js_urls[501], $urls['id2']);
+ $this->assertIdentical($js_urls[502], $urls['id3']);
$js_urls = elgg_get_loaded_js('footer');
$this->assertIdentical(array(), $js_urls);
diff --git a/engine/tests/api/metadata.php b/engine/tests/api/metadata.php
index d9113b68a..7897b8d47 100644
--- a/engine/tests/api/metadata.php
+++ b/engine/tests/api/metadata.php
@@ -75,16 +75,9 @@ class ElggCoreMetadataAPITest extends ElggCoreUnitTest {
$this->assertIdentical($case_true, $case_false);
- // check deprecated get_entities_from_metadata() function
- $deprecated = get_entities_from_metadata('metaUnitTest', 'tested', '', '', 0, 10, 0, '', 0, FALSE, TRUE);
- $this->assertIdentical($deprecated, $case_true);
-
- // check entity list
- //$this->dump(list_entities_from_metadata('metaUnitTest', 'Tested', '', '', 0, 10, TRUE, TRUE, TRUE, FALSE));
-
// clean up
- $this->delete_metastrings();
$this->object->delete();
+ $this->delete_metastrings();
}
public function testElggGetMetadataCount() {
diff --git a/engine/tests/api/plugins.php b/engine/tests/api/plugins.php
index 00b0d4513..a0faaff0e 100644
--- a/engine/tests/api/plugins.php
+++ b/engine/tests/api/plugins.php
@@ -68,8 +68,8 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
'blurb' => 'A concise description.',
'description' => 'A longer, more interesting description.',
'website' => 'http://www.elgg.org/',
- 'copyright' => '(C) Elgg 2010',
- 'license' => 'GNU Public License version 2',
+ 'copyright' => '(C) Elgg Foundation 2011',
+ 'license' => 'GNU General Public License version 2',
'requires' => array(
array('type' => 'elgg_version', 'version' => '3009030802', 'comparison' => 'lt'),
@@ -105,7 +105,6 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
array('type' => 'plugin', 'name' => 'facebook_connect', 'version' => 1.0),
),
- 'admin_interface' => 'simple',
'activate_on_install' => true
);
@@ -118,8 +117,8 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
'version' => '1.0',
'description' => 'A 1.7-style manifest.',
'website' => 'http://www.elgg.org/',
- 'copyright' => '(C) Elgg 2010',
- 'license' => 'GNU Public License version 2',
+ 'copyright' => '(C) Elgg Foundation 2011',
+ 'license' => 'GNU General Public License version 2',
'elgg_version' => '2009030702',
'name' => 'Plugin Test 17',
);
@@ -166,13 +165,13 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
}
public function testElggPluginManifestGetCopyright() {
- $this->assertEqual($this->manifest18->getCopyright(), '(C) Elgg 2010');
- $this->assertEqual($this->manifest18->getCopyright(), '(C) Elgg 2010');
+ $this->assertEqual($this->manifest18->getCopyright(), '(C) Elgg Foundation 2011');
+ $this->assertEqual($this->manifest18->getCopyright(), '(C) Elgg Foundation 2011');
}
public function testElggPluginManifestGetLicense() {
- $this->assertEqual($this->manifest18->getLicense(), 'GNU Public License version 2');
- $this->assertEqual($this->manifest17->getLicense(), 'GNU Public License version 2');
+ $this->assertEqual($this->manifest18->getLicense(), 'GNU General Public License version 2');
+ $this->assertEqual($this->manifest17->getLicense(), 'GNU General Public License version 2');
}
@@ -215,18 +214,6 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
$this->assertEqual($this->package17->getManifest()->getDescription(), 'A 1.7-style manifest.');
}
- public function testElggPluginManifestGetDescriptionTranslated() {
- $en = array(
- $this->package18->getManifest()->getDescription() => 'A translated 1.8 description!',
- $this->package17->getManifest()->getDescription() => 'A translated 1.7 description!',
- );
-
- add_translation('en', $en);
-
- $this->assertEqual($this->package18->getManifest()->getDescription(), 'A translated 1.8 description!');
- $this->assertEqual($this->package17->getManifest()->getDescription(), 'A translated 1.7 description!');
- }
-
public function testElggPluginManifestGetCategories() {
$categories = array(
'Admin', 'ServiceAPI'
@@ -277,10 +264,6 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
$this->assertEqual($this->manifest17->getConflicts(), array());
}
- public function testElggPluginManifestGetAdminInterface() {
- $this->assertEqual($this->manifest18->getAdminInterface(), 'simple');
- }
-
public function testElggPluginManifestGetActivateOnInstall() {
$this->assertEqual($this->manifest18->getActivateOnInstall(), true);
}
diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php
index c04bc60ff..c13b4c731 100644
--- a/engine/tests/objects/entities.php
+++ b/engine/tests/objects/entities.php
@@ -125,7 +125,7 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->assertIdentical(FALSE, elgg_get_annotations(array('guid' => $this->entity->getGUID(), 'type' => 'site', 'subtype' => 'fail')));
// clear annotation
- $this->assertTrue($this->entity->clearAnnotations());
+ $this->assertTrue($this->entity->deleteAnnotations());
$this->assertEqual($this->entity->countAnnotations('non_existent'), 0);
$this->assertIdentical(array(), elgg_get_annotations(array('guid' => $this->entity->getGUID())));
@@ -134,6 +134,7 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
// clean up
$this->assertTrue($this->entity->delete());
+ remove_subtype('site', 'testing');
}
public function testElggEntityCache() {
@@ -226,8 +227,8 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
}
public function testElggEntityMetadata() {
- // let's delte a non-existent metadata
- $this->assertFalse($this->entity->clearMetaData('important'));
+ // let's delete a non-existent metadata
+ $this->assertFalse($this->entity->deleteMetadata('important'));
// let's add the meatadata
$this->assertTrue($this->entity->important = 'indeed!');
@@ -236,16 +237,16 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
// test deleting incorrectly
// @link http://trac.elgg.org/ticket/2273
- $this->assertFalse($this->entity->clearMetaData('impotent'));
+ $this->assertFalse($this->entity->deleteMetadata('impotent'));
$this->assertEqual($this->entity->important, 'indeed!');
// get rid of one metadata
$this->assertEqual($this->entity->important, 'indeed!');
- $this->assertTrue($this->entity->clearMetaData('important'));
+ $this->assertTrue($this->entity->deleteMetadata('important'));
$this->assertEqual($this->entity->important, '');
// get rid of all metadata
- $this->assertTrue($this->entity->clearMetaData());
+ $this->assertTrue($this->entity->deleteMetadata());
$this->assertEqual($this->entity->less_important, '');
// clean up database
@@ -278,6 +279,10 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->entity->$name = $md;
$this->assertEqual($md, $this->entity->$name);
+
+ if ($save) {
+ $this->assertTrue($this->entity->delete());
+ }
}
}
@@ -292,6 +297,10 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->entity->$name = $md;
$this->assertEqual($md[0], $this->entity->$name);
+
+ if ($save) {
+ $this->assertTrue($this->entity->delete());
+ }
}
}
@@ -307,6 +316,10 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->entity->setMetaData($name, 'test2', '', true);
$this->assertEqual(array('test', 'test2'), $this->entity->$name);
+
+ if ($save) {
+ $this->assertTrue($this->entity->delete());
+ }
}
}
@@ -322,6 +335,10 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->entity->setMetaData($name, array('test2'), '', true);
$this->assertEqual(array('test', 'test2'), $this->entity->$name);
+
+ if ($save) {
+ $this->assertTrue($this->entity->delete());
+ }
}
}
@@ -338,11 +355,14 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->entity->setMetaData($name, $md2, '', true);
$this->assertEqual(array_merge($md, $md2), $this->entity->$name);
+
+ if ($save) {
+ $this->assertTrue($this->entity->delete());
+ }
}
}
- protected function save_entity($type='site')
- {
+ protected function save_entity($type='site') {
$this->entity->type = $type;
$this->assertNotEqual($this->entity->save(), 0);
}
diff --git a/engine/tests/objects/sites.php b/engine/tests/objects/sites.php
index d0d61dcab..e5acbb3f9 100644
--- a/engine/tests/objects/sites.php
+++ b/engine/tests/objects/sites.php
@@ -18,7 +18,7 @@ class ElggCoreSiteTest extends ElggCoreUnitTest {
* Called before each test method.
*/
public function setUp() {
- $this->site = new ElggSiteTest;
+ $this->site = new ElggSiteTest();
}
/**
diff --git a/engine/tests/objects/users.php b/engine/tests/objects/users.php
index ba93c2439..d1533c3d2 100644
--- a/engine/tests/objects/users.php
+++ b/engine/tests/objects/users.php
@@ -220,29 +220,6 @@ class ElggCoreUserTest extends ElggCoreUnitTest {
$this->user->delete();
}
- // remove in 1.9
- public function testElggUserIsAdminLegacy() {
- $this->user->save();
- $this->user->makeAdmin();
-
- $this->assertTrue($this->user->admin);
- $this->assertTrue($this->user->siteadmin);
-
- $this->user->removeAdmin();
- $this->user->delete();
- }
-
- public function testElggUserIsNotAdminLegacy() {
- $this->user->save();
- $this->user->removeAdmin();
-
- $this->assertFalse($this->user->admin);
- $this->assertFalse($this->user->siteadmin);
-
- $this->user->removeAdmin();
- $this->user->delete();
- }
-
protected function fetchUser($guid) {
global $CONFIG;
diff --git a/engine/tests/regression/trac_bugs.php b/engine/tests/regression/trac_bugs.php
index 6f98c67bd..2bfc37558 100644
--- a/engine/tests/regression/trac_bugs.php
+++ b/engine/tests/regression/trac_bugs.php
@@ -112,4 +112,91 @@ class ElggCoreRegressionBugsTest extends ElggCoreUnitTest {
$this->assertEqual($params['xoffset'], $options['x1']);
$this->assertEqual($params['yoffset'], $options['y1']);
}
+
+ // #3722 Check canEdit() works for contains regardless of groups
+ function test_can_write_to_container() {
+ $user = new ElggUser();
+ $user->username = 'test_user_' . rand();
+ $user->name = 'test_user_name_' . rand();
+ $user->email = 'test@user.net';
+ $user->container_guid = 0;
+ $user->owner_guid = 0;
+ $user->save();
+
+ $object = new ElggObject();
+ $object->save();
+
+ $group = new ElggGroup();
+ $group->save();
+
+ // disable access overrides because we're admin.
+ $ia = elgg_set_ignore_access(false);
+
+ $this->assertFalse(can_write_to_container($user->guid, $object->guid));
+
+ global $elgg_test_user;
+ $elgg_test_user = $user;
+
+ // register hook to allow access
+ function can_write_to_container_test_hook($hook, $type, $value, $params) {
+ global $elgg_test_user;
+
+ if ($params['user']->getGUID() == $elgg_test_user->getGUID()) {
+ return true;
+ }
+ }
+
+ elgg_register_plugin_hook_handler('container_permissions_check', 'all', 'can_write_to_container_test_hook');
+ $this->assertTrue(can_write_to_container($user->guid, $object->guid));
+ elgg_unregister_plugin_hook_handler('container_permissions_check', 'all', 'can_write_to_container_test_hook');
+
+ $this->assertFalse(can_write_to_container($user->guid, $group->guid));
+ $group->join($user);
+ $this->assertTrue(can_write_to_container($user->guid, $group->guid));
+
+ elgg_set_ignore_access($ia);
+
+ $user->delete();
+ $object->delete();
+ $group->delete();
+ }
+
+ function test_db_shutdown_links() {
+ global $DB_DELAYED_QUERIES, $test_results;
+ $DB_DELAYED_QUERIES = array();
+
+ function test_delayed_results($results) {
+ global $test_results;
+ $test_results = $results;
+ }
+
+ $q = 'SELECT 1 as test';
+
+ $links = array('read', 'write', get_db_link('read'), get_db_link('write'));
+
+ foreach ($links as $link) {
+ $DB_DELAYED_QUERIES = array();
+
+ $result = execute_delayed_query($q, $link, 'test_delayed_results');
+
+ $this->assertTrue($result, "Failed with link = $link");
+ $this->assertEqual(count($DB_DELAYED_QUERIES), 1);
+ $this->assertEqual($DB_DELAYED_QUERIES[0]['q'], $q);
+ $this->assertEqual($DB_DELAYED_QUERIES[0]['l'], $link);
+ $this->assertEqual($DB_DELAYED_QUERIES[0]['h'], 'test_delayed_results');
+
+ db_delayedexecution_shutdown_hook();
+
+ $num_rows = mysql_num_rows($test_results);
+ $this->assertEqual($num_rows, 1);
+ $row = mysql_fetch_assoc($test_results);
+ $this->assertEqual($row['test'], 1);
+ }
+
+ // test bad case
+ $DB_DELAYED_QUERIES = array();
+ $result = execute_delayed_query($q, 'not_a_link', 'test_delayed_results');
+ $this->assertFalse($result);
+ $this->assertEqual(array(), $DB_DELAYED_QUERIES);
+ }
}
diff --git a/engine/tests/suite.php b/engine/tests/suite.php
index 8f2eb41a3..4203bc5d6 100644
--- a/engine/tests/suite.php
+++ b/engine/tests/suite.php
@@ -9,6 +9,8 @@
require_once(dirname( __FILE__ ) . '/../start.php');
+admin_gatekeeper();
+
$vendor_path = "$CONFIG->path/vendors/simpletest";
$test_path = "$CONFIG->path/engine/tests";
diff --git a/engine/tests/test_files/plugin_17/manifest.xml b/engine/tests/test_files/plugin_17/manifest.xml
index bb178ab93..706734265 100644
--- a/engine/tests/test_files/plugin_17/manifest.xml
+++ b/engine/tests/test_files/plugin_17/manifest.xml
@@ -4,7 +4,7 @@
<field key="version" value="1.0" />
<field key="description" value="A 1.7-style manifest." />
<field key="website" value="http://www.elgg.org/" />
- <field key="copyright" value="(C) Elgg 2010" />
- <field key="license" value="GNU Public License version 2" />
+ <field key="copyright" value="(C) Elgg Foundation 2011" />
+ <field key="license" value="GNU General Public License version 2" />
<field key="elgg_version" value="2009030702" />
</plugin_manifest> \ No newline at end of file
diff --git a/engine/tests/test_files/plugin_18/manifest.xml b/engine/tests/test_files/plugin_18/manifest.xml
index 23f0fa0bf..e0776ffc1 100644
--- a/engine/tests/test_files/plugin_18/manifest.xml
+++ b/engine/tests/test_files/plugin_18/manifest.xml
@@ -6,8 +6,8 @@
<blurb>A concise description.</blurb>
<description>A longer, more interesting description.</description>
<website>http://www.elgg.org/</website>
- <copyright>(C) Elgg 2010</copyright>
- <license>GNU Public License version 2</license>
+ <copyright>(C) Elgg Foundation 2011</copyright>
+ <license>GNU General Public License version 2</license>
<requires>
<type>elgg_version</type>
@@ -34,7 +34,6 @@
<category>ServiceAPI</category>
- <admin_interface>simple</admin_interface>
<activate_on_install>true</activate_on_install>
<requires>
diff --git a/engine/tests/ui/submenu.php b/engine/tests/ui/submenu.php
deleted file mode 100644
index b401620f6..000000000
--- a/engine/tests/ui/submenu.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-/**
- * 1.8 submenu test.
- *
- * Submenu needs to be able to support being added out of order.
- * Children can be added before parents.
- * Children of parents never defined are never shown.
- *
- * Test against:
- * different contexts
- * different groups
- * old add_submenu_item() wrapper.
- *
- */
-
-/*
- * Tests need to be ported to new menu system
- *
-
-require_once('../../start.php');
-
-$url = "engine/tests/ui/submenu.php";
-
-$items = array(
- array(
- 'text' => 'Upper level 1',
- 'href' => "$url?upper_level_1",
- 'id' => 'ul1'
- ),
- array(
- 'text' => 'CD (No link)',
- 'parent_id' => 'cup',
- 'id' => 'cd',
- ),
- array(
- 'text' => 'Sub CD',
- 'href' => "$url?sub_cd",
- 'parent_id' => 'cd'
- ),
- array(
- 'text' => 'Cup',
- 'href' => "$url?cup",
- 'id' => 'cup'
- ),
- array(
- 'text' => 'Phone',
- 'href' => "$url?phone",
- 'id' => 'phone',
- 'parent_id' => 'cup'
- ),
- array(
- 'text' => 'Wallet',
- 'href' => "$url?wallet",
- 'id' => 'wallet',
- 'parent_id' => 'phone'
- ),
- array(
- 'text' => 'Upper level',
- 'href' => "$url?upper_level",
- 'id' => 'ul'
- ),
- array(
- 'text' => 'Sub Upper level',
- 'href' => "$url?sub_upper_level",
- 'parent_id' => 'ul'
- ),
- array(
- 'text' => 'Root',
- 'href' => $url,
- ),
-
- array(
- 'text' => 'I am an orphan',
- 'href' => 'http://google.com',
- 'parent_id' => 'missing_parent'
- ),
-
- array(
- 'text' => 'JS Test',
- 'href' => 'http://elgg.org',
- 'vars' => array('js' => 'onclick="alert(\'Link to \' + $(this).attr(\'href\') + \'!\'); return false;"')
- )
-);
-
-foreach ($items as $item) {
- elgg_add_submenu_item($item, 'main');
-}
-
-add_submenu_item('Old Onclick Test', 'http://elgg.com', NULL, TRUE);
-add_submenu_item('Old Selected Test', 'http://elgg.com', NULL, '', TRUE);
-
-
-elgg_add_submenu_item(array('text' => 'Not Main Test', 'href' => "$url?not_main_test"), 'not_main', 'new_menu');
-elgg_add_submenu_item(array('text' => 'Not Main C Test', 'href' => "$url?not_main_c_test"), 'not_main', 'new_menu');
-
-elgg_add_submenu_item(array('text' => 'All test', 'href' => "$url?all"), 'all');
-
-//elgg_set_context('not_main');
-
-$body = elgg_view_layout('one_sidebar', array('content' => 'Look right.'));
-echo elgg_view_page('Submenu Test', $body);
-
-*/