diff options
author | cash <cash.costello@gmail.com> | 2013-05-02 22:02:41 -0400 |
---|---|---|
committer | cash <cash.costello@gmail.com> | 2013-05-02 22:02:41 -0400 |
commit | d785357ba7cb9e8a6bb7b2f91bf389e6bd1e636b (patch) | |
tree | 3e0b3f8633aeffa61220e2ba3cfaffd9b6e1c2c1 /engine/tests | |
parent | 0726860ca04b4f2ed9b010cc5c5692c23c32e2d2 (diff) | |
download | elgg-d785357ba7cb9e8a6bb7b2f91bf389e6bd1e636b.tar.gz elgg-d785357ba7cb9e8a6bb7b2f91bf389e6bd1e636b.tar.bz2 |
Fixes #5418 adds enabled clause for annotations
Diffstat (limited to 'engine/tests')
-rw-r--r-- | engine/tests/api/metastrings.php | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/engine/tests/api/metastrings.php b/engine/tests/api/metastrings.php index 0a8945084..cfcfb6d07 100644 --- a/engine/tests/api/metastrings.php +++ b/engine/tests/api/metastrings.php @@ -55,8 +55,11 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest { * Called after each test method. */ public function tearDown() { - // do not allow SimpleTest to interpret Elgg notices as exceptions - $this->swallowErrors(); + access_show_hidden_entities(true); + elgg_delete_annotations(array( + 'guid' => $this->object->guid, + )); + access_show_hidden_entities(false); } /** @@ -98,6 +101,31 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest { } } + public function testGetMetastringObjectFromIDWithDisabledAnnotation() { + $name = 'test_annotation_name' . rand(); + $value = 'test_annotation_value' . rand(); + $id = create_annotation($this->object->guid, $name, $value); + $annotation = elgg_get_annotation_from_id($id); + $this->assertTrue($annotation->disable()); + + $test = elgg_get_metastring_based_object_from_id($id, 'annotation'); + $this->assertEqual(false, $test); + } + + public function testGetMetastringBasedObjectWithDisabledAnnotation() { + $name = 'test_annotation_name' . rand(); + $value = 'test_annotation_value' . rand(); + $id = create_annotation($this->object->guid, $name, $value); + $annotation = elgg_get_annotation_from_id($id); + $this->assertTrue($annotation->disable()); + + $test = elgg_get_metastring_based_objects(array( + 'metastring_type' => 'annotations', + 'guid' => $this->object->guid, + )); + $this->assertEqual(array(), $test); + } + public function testEnableDisableByID() { $db_prefix = elgg_get_config('dbprefix'); $annotations = $this->createAnnotations(1); |