Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@piwik.org>2018-05-20 22:14:10 +0300
committerdiosmosis <diosmosis@users.noreply.github.com>2018-05-20 22:14:10 +0300
commit509ac2f1085e74c6a44253248f9f2fc3ac54d337 (patch)
tree785e3898de3c0be2ebddb7a6682f1de31c7c4318 /plugins/Annotations
parent682cc40c9106e20b97d86a663d0f2c2714e32303 (diff)
Improve and split tests (#12822)
* Speed up some tests by not using IntegrationTestCase * fix test * split system tests into plugin & core * adjust travis submodule * Move Annotations system test to plugin * Move Transitions system test to plugin * fix tests * move PurgeDataTest to PrivacyManager plugin * Move some tests to Goal plugin * fix test * submodule update * Move tests to ecommerce plugin * adds a caching to prevent some duplicate api calls
Diffstat (limited to 'plugins/Annotations')
-rw-r--r--plugins/Annotations/tests/System/AnnotationsTest.php289
-rw-r--r--plugins/Annotations/tests/System/expected/test_annotations__Annotations.get.xml11
-rw-r--r--plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_day.xml13
-rw-r--r--plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_month.xml85
-rw-r--r--plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_week.xml21
-rw-r--r--plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_year.xml133
-rw-r--r--plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_day.xml12
-rw-r--r--plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_month.xml12
-rw-r--r--plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_week.xml12
-rw-r--r--plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_year.xml12
-rw-r--r--plugins/Annotations/tests/System/expected/test_annotations_lastN__Annotations.getAll_week.xml85
-rw-r--r--plugins/Annotations/tests/System/expected/test_annotations_lastN__Annotations.getAnnotationCountForDates_week.xml47
-rw-r--r--plugins/Annotations/tests/System/expected/test_annotations_multipleSites__Annotations.getAll_month.xml135
-rw-r--r--plugins/Annotations/tests/System/expected/test_annotations_multipleSites__Annotations.getAnnotationCountForDates_month.xml21
-rw-r--r--plugins/Annotations/tests/System/expected/test_annotations_range__Annotations.getAll_range.xml69
-rw-r--r--plugins/Annotations/tests/System/expected/test_annotations_range__Annotations.getAnnotationCountForDates_range.xml229
16 files changed, 1186 insertions, 0 deletions
diff --git a/plugins/Annotations/tests/System/AnnotationsTest.php b/plugins/Annotations/tests/System/AnnotationsTest.php
new file mode 100644
index 0000000000..d385d33426
--- /dev/null
+++ b/plugins/Annotations/tests/System/AnnotationsTest.php
@@ -0,0 +1,289 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+namespace Piwik\Plugins\Annotations\tests\System;
+
+use Piwik\API\Request;
+use Piwik\Plugins\Annotations\API;
+use Piwik\Tests\Framework\Mock\FakeAccess;
+use Piwik\Tests\Framework\TestCase\SystemTestCase;
+use Piwik\Tests\Fixtures\TwoSitesWithAnnotations;
+use Exception;
+
+/**
+ * @group Plugins
+ * @group AnnotationsTest
+ */
+class AnnotationsTest extends SystemTestCase
+{
+ public static $fixture = null;
+
+ public static function getOutputPrefix()
+ {
+ return 'annotations';
+ }
+
+ public function getApiForTesting()
+ {
+ $idSite1 = self::$fixture->idSite1;
+
+ return array(
+
+ // get
+ array('Annotations.get', array('idSite' => $idSite1,
+ 'date' => '2012-01-01',
+ 'periods' => 'day',
+ 'otherRequestParameters' => array('idNote' => 1))),
+
+ // getAll
+ array('Annotations.getAll', array('idSite' => $idSite1,
+ 'date' => '2011-12-01',
+ 'periods' => array('day', 'week', 'month'))),
+ array('Annotations.getAll', array('idSite' => $idSite1,
+ 'date' => '2012-01-01',
+ 'periods' => array('year'))),
+ array('Annotations.getAll', array('idSite' => $idSite1,
+ 'date' => '2012-03-01',
+ 'periods' => array('week'),
+ 'otherRequestParameters' => array('lastN' => 6),
+ 'testSuffix' => '_lastN')),
+ array('Annotations.getAll', array('idSite' => $idSite1,
+ 'date' => '2012-01-15,2012-02-15',
+ 'periods' => array('range'),
+ 'otherRequestParameters' => array('lastN' => 6),
+ 'testSuffix' => '_range')),
+ array('Annotations.getAll', array('idSite' => 'all',
+ 'date' => '2012-01-01',
+ 'periods' => array('month'),
+ 'testSuffix' => '_multipleSites')),
+
+ // getAnnotationCountForDates
+ array('Annotations.getAnnotationCountForDates', array('idSite' => $idSite1,
+ 'date' => '2011-12-01',
+ 'periods' => array('day', 'week', 'month'))),
+ array('Annotations.getAnnotationCountForDates', array('idSite' => $idSite1,
+ 'date' => '2012-01-01',
+ 'periods' => array('year'))),
+ array('Annotations.getAnnotationCountForDates', array('idSite' => $idSite1,
+ 'date' => '2012-03-01',
+ 'periods' => array('week'),
+ 'otherRequestParameters' => array('lastN' => 6),
+ 'testSuffix' => '_lastN')),
+ array('Annotations.getAnnotationCountForDates', array('idSite' => $idSite1,
+ 'date' => '2012-01-15,2012-02-15',
+ 'periods' => array('range'),
+ 'otherRequestParameters' => array('lastN' => 6),
+ 'testSuffix' => '_range')),
+ array('Annotations.getAnnotationCountForDates', array('idSite' => 'all',
+ 'date' => '2012-01-01',
+ 'periods' => array('month'),
+ 'testSuffix' => '_multipleSites')),
+ );
+ }
+
+ /**
+ * @dataProvider getApiForTesting
+ */
+ public function testApi($api, $params)
+ {
+ $this->runApiTests($api, $params);
+ }
+
+ public function testAddMultipleSitesFail()
+ {
+ try {
+ API::getInstance()->add("1,2,3", "2012-01-01", "whatever");
+ $this->fail("add should fail when given multiple sites in idSite");
+ } catch (Exception $ex) {
+ // pass
+ }
+ }
+
+ public function testAddInvalidDateFail()
+ {
+ try {
+ API::getInstance()->add(self::$fixture->idSite1, "invaliddate", "whatever");
+ $this->fail("add should fail when given invalid date");
+ } catch (Exception $ex) {
+ // pass
+ }
+ }
+
+ public function testSaveMultipleSitesFail()
+ {
+ try {
+ API::getInstance()->save("1,2,3", 0);
+ $this->fail("save should fail when given multiple sites");
+ } catch (Exception $ex) {
+ // pass
+ }
+ }
+
+ public function testSaveInvalidDateFail()
+ {
+ try {
+ API::getInstance()->save(self::$fixture->idSite1, 0, "invaliddate");
+ $this->fail("save should fail when given an invalid date");
+ } catch (Exception $ex) {
+ // pass
+ }
+ }
+
+ public function testSaveInvalidNoteIdFail()
+ {
+ try {
+ API::getInstance()->save(self::$fixture->idSite1, -1);
+ $this->fail("save should fail when given an invalid note id");
+ } catch (Exception $ex) {
+ // pass
+ }
+ }
+
+ public function testDeleteMultipleSitesFail()
+ {
+ try {
+ API::getInstance()->delete("1,2,3", 0);
+ $this->fail("delete should fail when given multiple site IDs");
+ } catch (Exception $ex) {
+ // pass
+ }
+ }
+
+ public function testDeleteInvalidNoteIdFail()
+ {
+ try {
+ API::getInstance()->delete(self::$fixture->idSite1, -1);
+ $this->fail("delete should fail when given an invalid site ID");
+ } catch (Exception $ex) {
+ // pass
+ }
+ }
+
+ public function testGetMultipleSitesFail()
+ {
+ try {
+ API::getInstance()->get("1,2,3", 0);
+ $this->fail("get should fail when given multiple site IDs");
+ } catch (Exception $ex) {
+ // pass
+ }
+ }
+
+ public function testGetInvalidNoteIdFail()
+ {
+ try {
+ API::getInstance()->get(self::$fixture->idSite1, -1);
+ $this->fail("get should fail when given an invalid note ID");
+ } catch (Exception $ex) {
+ // pass
+ }
+ }
+
+ public function testSaveSuccess()
+ {
+ API::getInstance()->save(
+ self::$fixture->idSite1, 0, $date = '2011-04-01', $note = 'new note text', $starred = 1);
+
+ $expectedAnnotation = array(
+ 'date' => '2011-04-01',
+ 'note' => 'new note text',
+ 'starred' => 1,
+ 'user' => 'superUserLogin',
+ 'idNote' => 0,
+ 'canEditOrDelete' => true
+ );
+ $this->assertEquals($expectedAnnotation, API::getInstance()->get(self::$fixture->idSite1, 0));
+ }
+
+ public function testSaveNoChangesSuccess()
+ {
+ API::getInstance()->save(self::$fixture->idSite1, 1);
+
+ $expectedAnnotation = array(
+ 'date' => '2011-12-02',
+ 'note' => '1: Site 1 annotation for 2011-12-02',
+ 'starred' => 0,
+ 'user' => 'superUserLogin',
+ 'idNote' => 1,
+ 'canEditOrDelete' => true
+ );
+ $this->assertEquals($expectedAnnotation, API::getInstance()->get(self::$fixture->idSite1, 1));
+ }
+
+ public function testDeleteSuccess()
+ {
+ API::getInstance()->delete(self::$fixture->idSite1, 1);
+
+ try {
+ API::getInstance()->get(self::$fixture->idSite1, 1);
+ $this->fail("failed to delete annotation");
+ } catch (Exception $ex) {
+ // pass
+ }
+ }
+
+ public function getPermissionsFailData()
+ {
+ return array(
+ // getAll
+ array(false, false, "module=API&method=Annotations.getAll&idSite=1&date=2012-01-01&period=year", true, "getAll should throw if user does not have view access"),
+
+ // get
+ array(false, false, "module=API&method=Annotations.get&idSite=1&idNote=0", true, "get should throw if user does not have view access"),
+
+ // getAnnotationCountForDates
+ array(false, false, "module=API&method=Annotations.getAnnotationCountForDates&idSite=1&date=2012-01-01&period=year", true, "getAnnotationCountForDates should throw if user does not have view access"),
+
+ // add
+ array(false, false, "module=API&method=Annotations.add&idSite=1&date=2011-02-01&note=whatever", true, "add should throw if user does not have view access"),
+ array(false, true, "module=API&method=Annotations.add&idSite=1&date=2011-02-01&note=whatever2", false, "add should not throw if user has view access"),
+ array(true, true, "module=API&method=Annotations.add&idSite=1&date=2011-02-01&note=whatever3", false, "add should not throw if user has admin access"),
+
+ // save
+ array(false, false, "module=API&method=Annotations.save&idSite=1&idNote=0&date=2011-03-01&note=newnote", true, "save should throw if user does not have view access"),
+ array(false, true, "module=API&method=Annotations.save&idSite=1&idNote=0&date=2011-03-01&note=newnote", true, "save should throw if user has view access but did not edit note"),
+ array(true, true, "module=API&method=Annotations.save&idSite=1&idNote=0&date=2011-03-01&note=newnote", false, "save should not throw if user has admin access"),
+
+ // delete
+ array(false, false, "module=API&method=Annotations.delete&idSite=1&idNote=0", true, "delete should throw if user does not have view access"),
+ array(false, true, "module=API&method=Annotations.delete&idSite=1&idNote=0", true, "delete should throw if user does not have view access"),
+ array(true, true, "module=API&method=Annotations.delete&idSite=1&idNote=0", false, "delete should not throw if user has admin access"),
+ );
+ }
+
+ /**
+ * @dataProvider getPermissionsFailData
+ */
+ public function testMethodPermissions($hasAdminAccess, $hasViewAccess, $request, $checkException, $failMessage)
+ {
+ // create fake access that denies user access
+ FakeAccess::$superUser = false;
+ FakeAccess::$idSitesAdmin = $hasAdminAccess ? array(self::$fixture->idSite1) : array();
+ FakeAccess::$idSitesView = $hasViewAccess ? array(self::$fixture->idSite1) : array();
+
+ if ($checkException) {
+ try {
+ $request = new Request($request);
+ $request->process();
+ $this->fail($failMessage);
+ } catch (Exception $ex) {
+ // pass
+ }
+ } else {
+ $request = new Request($request);
+ $request->process();
+
+ }
+ }
+
+ public static function getPathToTestDirectory()
+ {
+ return dirname(__FILE__);
+ }
+}
+
+AnnotationsTest::$fixture = new TwoSitesWithAnnotations(); \ No newline at end of file
diff --git a/plugins/Annotations/tests/System/expected/test_annotations__Annotations.get.xml b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.get.xml
new file mode 100644
index 0000000000..8ac7b4520a
--- /dev/null
+++ b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.get.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row>
+ <date>2011-12-02</date>
+ <note>1: Site 1 annotation for 2011-12-02</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>1</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_day.xml b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_day.xml
new file mode 100644
index 0000000000..c65b44912c
--- /dev/null
+++ b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_day.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row key="1">
+ <row>
+ <date>2011-12-01</date>
+ <note>0: Site 1 annotation for 2011-12-01</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>0</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_month.xml b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_month.xml
new file mode 100644
index 0000000000..fa326bf6fd
--- /dev/null
+++ b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_month.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row key="1">
+ <row>
+ <date>2011-12-01</date>
+ <note>0: Site 1 annotation for 2011-12-01</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>0</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2011-12-02</date>
+ <note>1: Site 1 annotation for 2011-12-02</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>1</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2011-12-08</date>
+ <note>2: Site 1 annotation for 2011-12-08</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>2</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2011-12-09</date>
+ <note>3: Site 1 annotation for 2011-12-09</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>3</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2011-12-15</date>
+ <note>4: Site 1 annotation for 2011-12-15</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>4</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2011-12-16</date>
+ <note>5: Site 1 annotation for 2011-12-16</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>5</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2011-12-22</date>
+ <note>6: Site 1 annotation for 2011-12-22</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>6</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2011-12-23</date>
+ <note>7: Site 1 annotation for 2011-12-23</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>7</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2011-12-29</date>
+ <note>8: Site 1 annotation for 2011-12-29</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>8</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2011-12-30</date>
+ <note>9: Site 1 annotation for 2011-12-30</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>9</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_week.xml b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_week.xml
new file mode 100644
index 0000000000..3d0078beac
--- /dev/null
+++ b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_week.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row key="1">
+ <row>
+ <date>2011-12-01</date>
+ <note>0: Site 1 annotation for 2011-12-01</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>0</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2011-12-02</date>
+ <note>1: Site 1 annotation for 2011-12-02</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>1</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_year.xml b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_year.xml
new file mode 100644
index 0000000000..f2f2835d16
--- /dev/null
+++ b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAll_year.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row key="1">
+ <row>
+ <date>2012-01-05</date>
+ <note>10: Site 1 annotation for 2012-01-05</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>10</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-06</date>
+ <note>11: Site 1 annotation for 2012-01-06</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>11</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-12</date>
+ <note>12: Site 1 annotation for 2012-01-12</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>12</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-13</date>
+ <note>13: Site 1 annotation for 2012-01-13</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>13</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-19</date>
+ <note>14: Site 1 annotation for 2012-01-19</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>14</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-20</date>
+ <note>15: Site 1 annotation for 2012-01-20</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>15</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-26</date>
+ <note>16: Site 1 annotation for 2012-01-26</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>16</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-27</date>
+ <note>17: Site 1 annotation for 2012-01-27</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>17</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-02</date>
+ <note>18: Site 1 annotation for 2012-02-02</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>18</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-03</date>
+ <note>19: Site 1 annotation for 2012-02-03</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>19</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-09</date>
+ <note>20: Site 1 annotation for 2012-02-09</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>20</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-10</date>
+ <note>21: Site 1 annotation for 2012-02-10</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>21</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-16</date>
+ <note>22: Site 1 annotation for 2012-02-16</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>22</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-17</date>
+ <note>23: Site 1 annotation for 2012-02-17</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>23</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-23</date>
+ <note>24: Site 1 annotation for 2012-02-23</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>24</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-24</date>
+ <note>25: Site 1 annotation for 2012-02-24</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>25</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_day.xml b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_day.xml
new file mode 100644
index 0000000000..7409bdf738
--- /dev/null
+++ b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_day.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row key="1">
+ <row>
+ <row>2011-12-01</row>
+ <row>
+ <count>1</count>
+ <starred>1</starred>
+ </row>
+ </row>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_month.xml b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_month.xml
new file mode 100644
index 0000000000..152be4e272
--- /dev/null
+++ b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_month.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row key="1">
+ <row>
+ <row>2011-12-01</row>
+ <row>
+ <count>10</count>
+ <starred>4</starred>
+ </row>
+ </row>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_week.xml b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_week.xml
new file mode 100644
index 0000000000..d428059285
--- /dev/null
+++ b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_week.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row key="1">
+ <row>
+ <row>2011-11-28</row>
+ <row>
+ <count>2</count>
+ <starred>1</starred>
+ </row>
+ </row>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_year.xml b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_year.xml
new file mode 100644
index 0000000000..3d501c35f1
--- /dev/null
+++ b/plugins/Annotations/tests/System/expected/test_annotations__Annotations.getAnnotationCountForDates_year.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row key="1">
+ <row>
+ <row>2012-01-01</row>
+ <row>
+ <count>16</count>
+ <starred>5</starred>
+ </row>
+ </row>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/Annotations/tests/System/expected/test_annotations_lastN__Annotations.getAll_week.xml b/plugins/Annotations/tests/System/expected/test_annotations_lastN__Annotations.getAll_week.xml
new file mode 100644
index 0000000000..d3aecc147b
--- /dev/null
+++ b/plugins/Annotations/tests/System/expected/test_annotations_lastN__Annotations.getAll_week.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row key="1">
+ <row>
+ <date>2012-01-26</date>
+ <note>16: Site 1 annotation for 2012-01-26</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>16</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-27</date>
+ <note>17: Site 1 annotation for 2012-01-27</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>17</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-02</date>
+ <note>18: Site 1 annotation for 2012-02-02</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>18</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-03</date>
+ <note>19: Site 1 annotation for 2012-02-03</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>19</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-09</date>
+ <note>20: Site 1 annotation for 2012-02-09</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>20</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-10</date>
+ <note>21: Site 1 annotation for 2012-02-10</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>21</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-16</date>
+ <note>22: Site 1 annotation for 2012-02-16</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>22</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-17</date>
+ <note>23: Site 1 annotation for 2012-02-17</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>23</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-23</date>
+ <note>24: Site 1 annotation for 2012-02-23</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>24</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-24</date>
+ <note>25: Site 1 annotation for 2012-02-24</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>25</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/Annotations/tests/System/expected/test_annotations_lastN__Annotations.getAnnotationCountForDates_week.xml b/plugins/Annotations/tests/System/expected/test_annotations_lastN__Annotations.getAnnotationCountForDates_week.xml
new file mode 100644
index 0000000000..2abbab5b3f
--- /dev/null
+++ b/plugins/Annotations/tests/System/expected/test_annotations_lastN__Annotations.getAnnotationCountForDates_week.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row key="1">
+ <row>
+ <row>2012-01-23</row>
+ <row>
+ <count>2</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-30</row>
+ <row>
+ <count>2</count>
+ <starred>1</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-06</row>
+ <row>
+ <count>2</count>
+ <starred>1</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-13</row>
+ <row>
+ <count>2</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-20</row>
+ <row>
+ <count>2</count>
+ <starred>1</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-27</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/Annotations/tests/System/expected/test_annotations_multipleSites__Annotations.getAll_month.xml b/plugins/Annotations/tests/System/expected/test_annotations_multipleSites__Annotations.getAll_month.xml
new file mode 100644
index 0000000000..0d3c8ae176
--- /dev/null
+++ b/plugins/Annotations/tests/System/expected/test_annotations_multipleSites__Annotations.getAll_month.xml
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row key="1">
+ <row>
+ <date>2012-01-05</date>
+ <note>10: Site 1 annotation for 2012-01-05</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>10</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-06</date>
+ <note>11: Site 1 annotation for 2012-01-06</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>11</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-12</date>
+ <note>12: Site 1 annotation for 2012-01-12</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>12</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-13</date>
+ <note>13: Site 1 annotation for 2012-01-13</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>13</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-19</date>
+ <note>14: Site 1 annotation for 2012-01-19</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>14</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-20</date>
+ <note>15: Site 1 annotation for 2012-01-20</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>15</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-26</date>
+ <note>16: Site 1 annotation for 2012-01-26</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>16</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-27</date>
+ <note>17: Site 1 annotation for 2012-01-27</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>17</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ </row>
+ <row key="2">
+ <row>
+ <date>2012-01-05</date>
+ <note>10: Site 2 annotation for 2012-01-05</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>10</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-06</date>
+ <note>11: Site 2 annotation for 2012-01-06</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>11</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-12</date>
+ <note>12: Site 2 annotation for 2012-01-12</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>12</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-13</date>
+ <note>13: Site 2 annotation for 2012-01-13</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>13</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-19</date>
+ <note>14: Site 2 annotation for 2012-01-19</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>14</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-20</date>
+ <note>15: Site 2 annotation for 2012-01-20</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>15</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-26</date>
+ <note>16: Site 2 annotation for 2012-01-26</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>16</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-27</date>
+ <note>17: Site 2 annotation for 2012-01-27</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>17</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/Annotations/tests/System/expected/test_annotations_multipleSites__Annotations.getAnnotationCountForDates_month.xml b/plugins/Annotations/tests/System/expected/test_annotations_multipleSites__Annotations.getAnnotationCountForDates_month.xml
new file mode 100644
index 0000000000..8549b62364
--- /dev/null
+++ b/plugins/Annotations/tests/System/expected/test_annotations_multipleSites__Annotations.getAnnotationCountForDates_month.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row key="1">
+ <row>
+ <row>2012-01-01</row>
+ <row>
+ <count>8</count>
+ <starred>2</starred>
+ </row>
+ </row>
+ </row>
+ <row key="2">
+ <row>
+ <row>2012-01-01</row>
+ <row>
+ <count>8</count>
+ <starred>2</starred>
+ </row>
+ </row>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/Annotations/tests/System/expected/test_annotations_range__Annotations.getAll_range.xml b/plugins/Annotations/tests/System/expected/test_annotations_range__Annotations.getAll_range.xml
new file mode 100644
index 0000000000..2e351524dc
--- /dev/null
+++ b/plugins/Annotations/tests/System/expected/test_annotations_range__Annotations.getAll_range.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row key="1">
+ <row>
+ <date>2012-01-19</date>
+ <note>14: Site 1 annotation for 2012-01-19</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>14</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-20</date>
+ <note>15: Site 1 annotation for 2012-01-20</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>15</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-26</date>
+ <note>16: Site 1 annotation for 2012-01-26</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>16</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-01-27</date>
+ <note>17: Site 1 annotation for 2012-01-27</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>17</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-02</date>
+ <note>18: Site 1 annotation for 2012-02-02</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>18</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-03</date>
+ <note>19: Site 1 annotation for 2012-02-03</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>19</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-09</date>
+ <note>20: Site 1 annotation for 2012-02-09</note>
+ <starred>0</starred>
+ <user>superUserLogin</user>
+ <idNote>20</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ <row>
+ <date>2012-02-10</date>
+ <note>21: Site 1 annotation for 2012-02-10</note>
+ <starred>1</starred>
+ <user>superUserLogin</user>
+ <idNote>21</idNote>
+ <canEditOrDelete>1</canEditOrDelete>
+ </row>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/Annotations/tests/System/expected/test_annotations_range__Annotations.getAnnotationCountForDates_range.xml b/plugins/Annotations/tests/System/expected/test_annotations_range__Annotations.getAnnotationCountForDates_range.xml
new file mode 100644
index 0000000000..77c83c9c84
--- /dev/null
+++ b/plugins/Annotations/tests/System/expected/test_annotations_range__Annotations.getAnnotationCountForDates_range.xml
@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row key="1">
+ <row>
+ <row>2012-01-15</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-16</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-17</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-18</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-19</row>
+ <row>
+ <count>1</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-20</row>
+ <row>
+ <count>1</count>
+ <starred>1</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-21</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-22</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-23</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-24</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-25</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-26</row>
+ <row>
+ <count>1</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-27</row>
+ <row>
+ <count>1</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-28</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-29</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-30</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-01-31</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-01</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-02</row>
+ <row>
+ <count>1</count>
+ <starred>1</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-03</row>
+ <row>
+ <count>1</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-04</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-05</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-06</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-07</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-08</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-09</row>
+ <row>
+ <count>1</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-10</row>
+ <row>
+ <count>1</count>
+ <starred>1</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-11</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-12</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-13</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-14</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ <row>
+ <row>2012-02-15</row>
+ <row>
+ <count>0</count>
+ <starred>0</starred>
+ </row>
+ </row>
+ </row>
+</result> \ No newline at end of file