From 993ccb6d2433c6316e45dda23387f161c1f70e03 Mon Sep 17 00:00:00 2001 From: nickw Date: Thu, 8 Oct 2009 16:27:11 +0000 Subject: Adding generic unit tests for ElggEntity. git-svn-id: http://code.elgg.org/elgg/trunk@3516 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/entities.php | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 3eaea5136..779efb7af 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -5,9 +5,7 @@ * * @package Elgg * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ */ @@ -149,6 +147,8 @@ * Q: Why are we not using __set overload here? * A: Because overload operators cause problems during subclassing, so we put the code here and * create overloads in subclasses. + * + * @todo Move "title" logic to applicable extending classes. * * @param string $name * @param mixed $value @@ -203,7 +203,9 @@ * @param string $name * @return mixed */ - function __get($name) { return $this->get($name); } + function __get($name) { + return $this->get($name); + } /** * Class member set overloading @@ -212,7 +214,9 @@ * @param mixed $value * @return mixed */ - function __set($name, $value) { return $this->set($name, $value); } + function __set($name, $value) { + return $this->set($name, $value); + } /** * Supporting isset. @@ -220,7 +224,14 @@ * @param string $name The name of the attribute or metadata. * @return bool */ - function __isset($name) { if ($this->$name!="") return true; else return false; } + function __isset($name) { + if ($this->$name!="") { + return true; + } + else { + return false; + } + } /** * Supporting unsetting of magic attributes. @@ -635,7 +646,8 @@ } else { - $this->attributes['guid'] = create_entity($this->attributes['type'], $this->attributes['subtype'], $this->attributes['owner_guid'], $this->attributes['access_id'], $this->attributes['site_guid'], $this->attributes['container_guid']); // Create a new entity (nb: using attribute array directly 'cos set function does something special!) + // Create a new entity (nb: using attribute array directly 'cos set function does something special!) + $this->attributes['guid'] = create_entity($this->attributes['type'], $this->attributes['subtype'], $this->attributes['owner_guid'], $this->attributes['access_id'], $this->attributes['site_guid'], $this->attributes['container_guid']); if (!$this->attributes['guid']) throw new IOException(elgg_echo('IOException:BaseEntitySaveFailed')); // Save any unsaved metadata TODO: How to capture extra information (access id etc) @@ -2775,7 +2787,7 @@ */ function entities_test($hook, $type, $value, $params) { global $CONFIG; - $params[] = $CONFIG->path . 'engine/tests/core/entities.php'; + $params[] = $CONFIG->path . 'engine/tests/objects/entities.php'; return $params; } -- cgit v1.2.3