diff options
author | Cash Costello <cash.costello@gmail.com> | 2013-05-11 07:01:55 -0700 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2013-05-11 07:01:55 -0700 |
commit | d6166b326ea6f25c477e2f47e9e8aef6a2af2597 (patch) | |
tree | df8d1bbcbd4866a0d11850f26349aefb29b56201 /engine/tests/api/metastrings.php | |
parent | 4bd919e25319c75c199490f1f064643c5df799ff (diff) | |
parent | 4129637ba28113cea9b27a9644d51354f67e9f55 (diff) | |
download | elgg-d6166b326ea6f25c477e2f47e9e8aef6a2af2597.tar.gz elgg-d6166b326ea6f25c477e2f47e9e8aef6a2af2597.tar.bz2 |
Merge pull request #5427 from cash/enabled_annotations
Fixes #5418 adds enabled clause for annotations
Diffstat (limited to 'engine/tests/api/metastrings.php')
-rw-r--r-- | engine/tests/api/metastrings.php | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/engine/tests/api/metastrings.php b/engine/tests/api/metastrings.php index 0a8945084..5efdab972 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); @@ -119,7 +147,6 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest { // enable $ashe = access_get_show_hidden_status(); access_show_hidden_entities(true); - flush(); $this->assertTrue(elgg_set_metastring_based_object_enabled_by_id($id, 'yes', $type)); $test = get_data($q); |