From f48bd5099f033cc148f9c1e3f781f8c932bda891 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 26 Mar 2011 14:31:14 +0000 Subject: Closes #3202 'count' already supported, added unit tests git-svn-id: http://code.elgg.org/elgg/trunk@8840 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/tests/api/annotations.php | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 engine/tests/api/annotations.php (limited to 'engine/tests/api/annotations.php') diff --git a/engine/tests/api/annotations.php b/engine/tests/api/annotations.php new file mode 100644 index 000000000..d7551a0fa --- /dev/null +++ b/engine/tests/api/annotations.php @@ -0,0 +1,46 @@ +object = new ElggObject(); + } + + /** + * Called after each test method. + */ + public function tearDown() { + // do not allow SimpleTest to interpret Elgg notices as exceptions + $this->swallowErrors(); + + unset($this->object); + } + + public function testElggGetAnnotationsCount() { + $this->object->title = 'Annotation Unit Test'; + $this->object->save(); + + $guid = $this->object->getGUID(); + create_annotation($guid, 'tested', 'tested1', 'text', 0, ACCESS_PUBLIC); + create_annotation($guid, 'tested', 'tested2', 'text', 0, ACCESS_PUBLIC); + + $count = (int)elgg_get_annotations(array( + 'annotation_names' => array('tested'), + 'guid' => $guid, + 'count' => true, + )); + + $this->assertIdentical($count, 2); + + $this->object->delete(); + } +} -- cgit v1.2.3