3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * Test class for CRM_Activity_BAO_ActivityTarget BAO
18 class CRM_Activity_BAO_ActivityTargetTest
extends CiviUnitTestCase
{
20 public function testRetrieveTargetIdsByActivityIdZeroID() {
21 $this->activityCreate();
22 $target = CRM_Activity_BAO_ActivityTarget
::retrieveTargetIdsByActivityId(0);
23 $this->assertSame($target, [], 'No targets returned');
26 public function testRetrieveTargetIdsByActivityIdOneID() {
27 $activity = $this->activityCreate();
29 $targetIDs = CRM_Activity_BAO_ActivityTarget
::retrieveTargetIdsByActivityId($activity['id']);
31 // assert that we have at least one targetID
32 $this->assertEquals(count($targetIDs), 1, 'One target ID match for activity');
33 $this->assertEquals($targetIDs[0], $activity['target_contact_id'], 'The returned target contacts ids match');