3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 require_once 'CiviTest/CiviUnitTestCase.php';
32 * Test class for CRM_Activity_BAO_ActivityAssignment BAO
36 class CRM_Activity_BAO_ActivityAssignmentTest
extends CiviUnitTestCase
{
39 * Sets up the fixture, for example, opens a network connection.
40 * This method is called before a test is executed.
44 protected function setUp() {
49 * Tears down the fixture, for example, closes a network connection.
50 * This method is called after a test is executed.
54 protected function tearDown() {}
57 * Pass zero as an id and make sure no Assignees are retrieved
59 function testRetrieveAssigneeIdsByActivityIdNoId() {
60 $activity = $this->activityCreate();
61 $activityId = CRM_Activity_BAO_ActivityAssignment
::retrieveAssigneeIdsByActivityId(0);
63 $this->assertEquals(count($activityId), 0, '0 assignees retrieved');
67 * Pass null as an id and make sure no Assignees are retrieved
69 function testRetrieveAssigneeIdsByActivityIdNullId() {
70 $activity = $this->activityCreate();
71 $activityId = CRM_Activity_BAO_ActivityAssignment
::retrieveAssigneeIdsByActivityId(Null);
73 $this->assertEquals(count($activityId), 0, '0 assignees retrieved using null');
77 * Pass a string as an id and make sure no Assignees are retrieved
79 function testRetrieveAssigneeIdsByActivityIdString() {
80 $activity = $this->activityCreate();
81 $activityId = CRM_Activity_BAO_ActivityAssignment
::retrieveAssigneeIdsByActivityId('test');
83 $this->assertEquals(count($activityId), 0, '0 assignees retrieved using string');
87 * Pass a known activity id as an id and make sure 1 Assignees is retrieved
89 function testRetrieveAssigneeIdsByActivityIdOneId() {
90 $activity = $this->activityCreate();
91 $activityId = CRM_Activity_BAO_ActivityAssignment
::retrieveAssigneeIdsByActivityId($activity['id']);
93 $this->assertEquals(count($activityId), 1, 'One record retrieved');
97 * Pass zero as an id and make sure no Assignees are retrieved
99 function testGetAssigneeNamesNoId() {
100 $activity = $this->activityCreate();
101 $assignees = CRM_Activity_BAO_ActivityAssignment
::getAssigneeNames(0);
103 $this->assertEquals(count($assignees), 0, '0 assignee names retrieved');
107 * Pass Null as an id and make sure no Assignees are retrieved
109 function testGetAssigneeNamesNullId() {
110 $activity = $this->activityCreate();
111 $assignees = CRM_Activity_BAO_ActivityAssignment
::getAssigneeNames(Null);
113 $this->assertEquals(count($assignees), 0, '0 assignee names retrieved');
117 * Pass a known activity id as an id and make sure 1 Assignees is retrieved
119 function testGetAssigneeNamesOneId() {
120 $activity = $this->activityCreate();
121 $assignees = CRM_Activity_BAO_ActivityAssignment
::getAssigneeNames(array($activity['id']));
122 $this->assertEquals(count($assignees), 1, '1 assignee names retrieved');