diff options
author | cash <cash.costello@gmail.com> | 2013-03-06 16:12:33 -0500 |
---|---|---|
committer | cash <cash.costello@gmail.com> | 2013-03-06 16:12:33 -0500 |
commit | 6955850778c68412983e2acf4b26f4bece199eae (patch) | |
tree | 4a5f62ff417149d3fac6468301558708af04ee62 /engine/tests/api | |
parent | 4b889e9cc7c629bb408fc8e470a80a7ab283fffc (diff) | |
download | elgg-6955850778c68412983e2acf4b26f4bece199eae.tar.gz elgg-6955850778c68412983e2acf4b26f4bece199eae.tar.bz2 |
added a unit test for checking counting entities from egefac
Diffstat (limited to 'engine/tests/api')
-rw-r--r-- | engine/tests/api/entity_getter_functions.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php index 52470e19d..7bf8ef04a 100644 --- a/engine/tests/api/entity_getter_functions.php +++ b/engine/tests/api/entity_getter_functions.php @@ -2729,6 +2729,36 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } } + public function testElggGetEntitiesFromAnnotationCalculationCount() { + // add two annotations with a unique name to an entity + // then count the number of entities with that annotation name + + $subtypes = $this->getRandomValidSubtypes(array('object'), 1); + $name = 'test_annotation_' . rand(0, 9999); + $values = array(); + $options = array( + 'type' => 'object', + 'subtypes' => $subtypes, + 'limit' => 1 + ); + $es = elgg_get_entities($options); + $entity = $es[0]; + $value = rand(0, 9999); + $entity->annotate($name, $value); + $value = rand(0, 9999); + $entity->annotate($name, $value); + + $options = array( + 'type' => 'object', + 'subtypes' => $subtypes, + 'annotation_name' => $name, + 'calculation' => 'count', + 'count' => true, + ); + $count = (int)elgg_get_entities_from_annotation_calculation($options); + $this->assertEqual(1, $count); + } + public function testElggGetAnnotationsAnnotationNames() { $options = array('annotation_names' => array()); $a_e_map = array(); |