From d785357ba7cb9e8a6bb7b2f91bf389e6bd1e636b Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 2 May 2013 22:02:41 -0400 Subject: Fixes #5418 adds enabled clause for annotations --- engine/tests/api/metastrings.php | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'engine/tests/api/metastrings.php') 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); -- cgit v1.2.3 From 4c82412b8f20a17ecb87b495af5fbbc0700c28c3 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 2 May 2013 22:08:48 -0400 Subject: not sure what a flush() is doing there --- engine/tests/api/metastrings.php | 1 - 1 file changed, 1 deletion(-) (limited to 'engine/tests/api/metastrings.php') diff --git a/engine/tests/api/metastrings.php b/engine/tests/api/metastrings.php index cfcfb6d07..5efdab972 100644 --- a/engine/tests/api/metastrings.php +++ b/engine/tests/api/metastrings.php @@ -147,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); -- cgit v1.2.3