return get_entities_from_relationship("member_of_site", $object_guid, false, "site", "", 0, "time_created desc", $limit, $offset);
}
-
-?>
\ No newline at end of file
+
+/**
+ * Runs unit tests for ElggObject
+ */
+register_plugin_hook('unit_test', 'system', 'objects_test');
+function objects_test($hook, $type, $value, $params) {
+ global $CONFIG;
+ $value[] = "{$CONFIG->path}engine/tests/objects/objects.php";
+ return $value;
+}
$annotations = $this->entity->getAnnotations('non_existent');
$this->assertIsA($annotations[0], 'ElggAnnotation');
$this->assertIdentical($annotations[0]->name, 'non_existent');
+ $this->assertEqual($this->entity->countAnnotations('non_existent'), 1);
+
+ // clear annotation
+ $this->assertTrue($this->entity->clearAnnotations());
+ $this->assertEqual($this->entity->countAnnotations('non_existent'), 0);
// clean up
$this->assertTrue($this->entity->delete());
--- /dev/null
+<?php
+/**
+ * Elgg Test ElggObject
+ *
+ * @package Elgg
+ * @subpackage Test
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
+class ElggCoreObjectTest extends ElggCoreUnitTest {
+
+ /**
+ * Called before each test object.
+ */
+ public function __construct() {
+ parent::__construct();
+ }
+
+ /**
+ * Called before each test method.
+ */
+ public function setUp() {
+ $this->entity = new ElggObjectTest();
+ }
+
+ /**
+ * Called after each test method.
+ */
+ public function tearDown() {
+ unset($this->entity);
+ }
+
+ /**
+ * Called after each test object.
+ */
+ public function __destruct() {
+ parent::__destruct();
+ }
+
+ /**
+ * A basic test that will be called and fail.
+ */
+ public function testElggEntityConstructor() {
+ $attributes = array();
+ $attributes['guid'] = '';
+ $attributes['type'] = 'object';
+ $attributes['subtype'] = '';
+ $attributes['owner_guid'] = get_loggedin_userid();
+ $attributes['container_guid'] = get_loggedin_userid();
+ $attributes['site_guid'] = 0;
+ $attributes['access_id'] = ACCESS_PRIVATE;
+ $attributes['time_created'] = '';
+ $attributes['time_updated'] = '';
+ $attributes['enabled'] = 'yes';
+ $attributes['tables_split'] = 2;
+ $attributes['tables_loaded'] = 0;
+ $attributes['title'] = '';
+ $attributes['description'] = '';
+
+ $this->assertIdentical($this->entity->expose_attributes(), $attributes);
+ }
+}
+
+class ElggObjectTest extends ElggObject {
+ public function expose_attributes() {
+ return $this->attributes;
+ }
+}
* Called before each test object.
*/
public function __construct() {
- // first, hook into ElggCoreUnitTest::__construct()
- $this->__construct();
+ parent::__construct();
}
/**
* Called after each test object.
*/
public function __destruct() {
- // hook into ElggCoreUnitTest::__destruct();
- $this->__destruct();
+ parent::__destruct();
}
/**