aboutsummaryrefslogtreecommitdiff
path: root/engine/tests
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2013-03-06 14:38:25 -0800
committerCash Costello <cash.costello@gmail.com>2013-03-06 14:38:25 -0800
commitd051e788e7ded0811dd14c6b47bcbda602737539 (patch)
tree28fbf76261692964e9391134c3cf06da022f879a /engine/tests
parent4b889e9cc7c629bb408fc8e470a80a7ab283fffc (diff)
parent2dbb9772881131f5739bae2d1ce5955587e9ab78 (diff)
downloadelgg-d051e788e7ded0811dd14c6b47bcbda602737539.tar.gz
elgg-d051e788e7ded0811dd14c6b47bcbda602737539.tar.bz2
Merge pull request #5203 from cash/bug_4393
Fixes the count issue with elgg_get_entities_from_annotation_calculation()
Diffstat (limited to 'engine/tests')
-rw-r--r--engine/tests/api/entity_getter_functions.php30
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();