aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/classes/ElggAnnotation.php2
-rw-r--r--engine/lib/access.php2
-rw-r--r--engine/lib/annotations.php8
-rw-r--r--engine/tests/api/access_collections.php8
-rw-r--r--engine/tests/api/helpers.php8
-rw-r--r--engine/tests/api/metadata.php7
-rw-r--r--engine/tests/objects/entities.php12
-rw-r--r--engine/tests/objects/users.php23
-rw-r--r--engine/tests/regression/trac_bugs.php4
-rw-r--r--mod/groups/start.php6
10 files changed, 28 insertions, 52 deletions
diff --git a/engine/classes/ElggAnnotation.php b/engine/classes/ElggAnnotation.php
index 78d29ee7f..511b5151f 100644
--- a/engine/classes/ElggAnnotation.php
+++ b/engine/classes/ElggAnnotation.php
@@ -78,7 +78,7 @@ class ElggAnnotation extends ElggExtender {
* @return bool
*/
function delete() {
- remove_from_river_by_annotation($this->id);
+ elgg_delete_river(array('annotation_id' => $this->id));
return elgg_delete_metastring_based_object_by_id($this->id, 'annotations');
}
diff --git a/engine/lib/access.php b/engine/lib/access.php
index e8cec50d0..ae64f832a 100644
--- a/engine/lib/access.php
+++ b/engine/lib/access.php
@@ -460,7 +460,7 @@ function can_edit_access_collection($collection_id, $user_guid = null) {
if ($user_guid) {
$user = get_entity((int) $user_guid);
} else {
- $user = get_loggedin_user();
+ $user = elgg_get_logged_in_user_entity();
}
$collection = get_access_collection($collection_id);
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index 814c3555b..c227c5516 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -56,14 +56,14 @@ function elgg_delete_annotation_by_id($id) {
* @param int $entity_guid Entity Guid
* @param string $name Name of annotation
* @param string $value Value of annotation
- * @param string $value_type Type of value
- * @param int $owner_guid Owner of annotation
+ * @param string $value_type Type of value (default is auto detection)
+ * @param int $owner_guid Owner of annotation (default is logged in user)
* @param int $access_id Access level of annotation
*
* @return int|bool id on success or false on failure
*/
-function create_annotation($entity_guid, $name, $value, $value_type,
-$owner_guid, $access_id = ACCESS_PRIVATE) {
+function create_annotation($entity_guid, $name, $value, $value_type = '',
+$owner_guid = 0, $access_id = ACCESS_PRIVATE) {
global $CONFIG;
$result = false;
diff --git a/engine/tests/api/access_collections.php b/engine/tests/api/access_collections.php
index 1e61c45bb..bc5408546 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,14 @@ 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');
}
// 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 +231,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/helpers.php b/engine/tests/api/helpers.php
index 36d680d54..3f41400c8 100644
--- a/engine/tests/api/helpers.php
+++ b/engine/tests/api/helpers.php
@@ -166,7 +166,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 +182,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']));
diff --git a/engine/tests/api/metadata.php b/engine/tests/api/metadata.php
index d9113b68a..208024e65 100644
--- a/engine/tests/api/metadata.php
+++ b/engine/tests/api/metadata.php
@@ -75,13 +75,6 @@ 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();
diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php
index c04bc60ff..c0a7b96b3 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())));
@@ -226,8 +226,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 +236,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
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 23d6d1dc6..2bfc37558 100644
--- a/engine/tests/regression/trac_bugs.php
+++ b/engine/tests/regression/trac_bugs.php
@@ -146,9 +146,9 @@ class ElggCoreRegressionBugsTest extends ElggCoreUnitTest {
}
}
- register_plugin_hook('container_permissions_check', 'all', 'can_write_to_container_test_hook');
+ 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));
- unregister_plugin_hook('container_permissions_check', 'all', 'can_write_to_container_test_hook');
+ 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);
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 0425bdea6..1b5b03ce7 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -562,8 +562,10 @@ function groups_user_join_event_listener($event, $object_type, $object) {
* Make sure users are added to the access collection
*/
function groups_access_collection_override($hook, $entity_type, $returnvalue, $params) {
- if (elgg_instanceof(get_entity($params['collection']->owner_guid), 'group')) {
- return true;
+ if (isset($params['collection'])) {
+ if (elgg_instanceof(get_entity($params['collection']->owner_guid), 'group')) {
+ return true;
+ }
}
}