aboutsummaryrefslogtreecommitdiff
path: root/engine/tests/api/entity_getter_functions.php
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2014-01-22 04:05:47 +0100
committerSem <sembrestels@riseup.net>2014-01-22 04:05:47 +0100
commit68614b769f4ae4f28c3f395f47b68baba7c48c64 (patch)
tree2c5a744a3859d27883f92b72aef9cf81f1a947d0 /engine/tests/api/entity_getter_functions.php
parent69e2d8c5d8732042c9319aef1fdea45a82b63e42 (diff)
parentc0295c275d6edbca6c6c8bb51dc199150d0d5fc3 (diff)
downloadelgg-68614b769f4ae4f28c3f395f47b68baba7c48c64.tar.gz
elgg-68614b769f4ae4f28c3f395f47b68baba7c48c64.tar.bz2
Merge branch 'release/1.8.1'
Diffstat (limited to 'engine/tests/api/entity_getter_functions.php')
-rw-r--r--engine/tests/api/entity_getter_functions.php68
1 files changed, 66 insertions, 2 deletions
diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php
index 9db248de9..fef9dc0c5 100644
--- a/engine/tests/api/entity_getter_functions.php
+++ b/engine/tests/api/entity_getter_functions.php
@@ -2648,7 +2648,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
$name = 'test_annotation_' . rand(0, 9999);
$values = array();
$options = array(
- 'types' => 'object',
+ 'type' => 'object',
'subtypes' => $subtypes,
'limit' => 5
);
@@ -2687,7 +2687,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
$order = array_keys($values);
$options = array(
- 'types' => 'object',
+ 'type' => 'object',
'subtypes' => $subtypes,
'limit' => 5,
'annotation_name' => $name,
@@ -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 = elgg_get_entities_from_annotation_calculation($options);
+ $this->assertEqual(1, $count);
+ }
+
public function testElggGetAnnotationsAnnotationNames() {
$options = array('annotation_names' => array());
$a_e_map = array();
@@ -2817,4 +2847,38 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
$entities = elgg_get_entities($options);
$this->assertFalse($entities);
}
+
+ public function testEGEEmptySubtypePlurality() {
+ $options = array(
+ 'type' => 'user',
+ 'subtypes' => ''
+ );
+
+ $entities = elgg_get_entities($options);
+ $this->assertTrue(is_array($entities));
+
+ $options = array(
+ 'type' => 'user',
+ 'subtype' => ''
+ );
+
+ $entities = elgg_get_entities($options);
+ $this->assertTrue(is_array($entities));
+
+ $options = array(
+ 'type' => 'user',
+ 'subtype' => array('')
+ );
+
+ $entities = elgg_get_entities($options);
+ $this->assertTrue(is_array($entities));
+
+ $options = array(
+ 'type' => 'user',
+ 'subtypes' => array('')
+ );
+
+ $entities = elgg_get_entities($options);
+ $this->assertTrue(is_array($entities));
+ }
}