aboutsummaryrefslogtreecommitdiff
path: root/engine/tests/objects/entities.php
diff options
context:
space:
mode:
authornickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-02 20:26:50 +0000
committernickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-02 20:26:50 +0000
commit81decf8b30a6814f7e0514fdacbadb1368fe306d (patch)
tree1f7e0475e5f8fd932865c1c373c9fb27e47158d6 /engine/tests/objects/entities.php
parent357f49695c27ac0161307b96436a8fb05147305d (diff)
downloadelgg-81decf8b30a6814f7e0514fdacbadb1368fe306d.tar.gz
elgg-81decf8b30a6814f7e0514fdacbadb1368fe306d.tar.bz2
Requesting annotations from a non-existent subtype will now return nothing instead of everything.
This functionality is required to preserve context. git-svn-id: http://code.elgg.org/elgg/trunk@6331 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/tests/objects/entities.php')
-rw-r--r--engine/tests/objects/entities.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php
index 1504c2f93..eb6eee2a3 100644
--- a/engine/tests/objects/entities.php
+++ b/engine/tests/objects/entities.php
@@ -109,16 +109,26 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->assertTrue(array_key_exists('non_existent', $this->entity->expose_annotations()));
// save entity and check for annotation
+ $this->entity->subtype = 'testing';
$this->save_entity();
$this->assertFalse(array_key_exists('non_existent', $this->entity->expose_annotations()));
$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);
+
+ $this->assertIdentical($annotations, get_annotations($this->entity->getGUID()));
+ $this->assertIdentical($annotations, get_annotations($this->entity->getGUID(), 'site'));
+ $this->assertIdentical($annotations, get_annotations($this->entity->getGUID(), 'site', 'testing'));
+ $this->assertIdentical(FALSE, get_annotations($this->entity->getGUID(), 'site', 'fail'));
// clear annotation
$this->assertTrue($this->entity->clearAnnotations());
$this->assertEqual($this->entity->countAnnotations('non_existent'), 0);
+
+ $this->assertIdentical(FALSE, get_annotations($this->entity->getGUID()));
+ $this->assertIdentical(FALSE, get_annotations($this->entity->getGUID(), 'site'));
+ $this->assertIdentical(FALSE, get_annotations($this->entity->getGUID(), 'site', 'testing'));
// clean up
$this->assertTrue($this->entity->delete());