(NFC) (dev/core#878) Simplify copyright header (tests/*)
[civicrm-core.git] / tests / phpunit / CRM / Activity / BAO / ActivityTargetTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 +--------------------------------------------------------------------+
10 */
11
12 /**
13 * Test class for CRM_Activity_BAO_ActivityTarget BAO
14 *
15 * @package CiviCRM
16 * @group headless
17 */
18 class CRM_Activity_BAO_ActivityTargetTest extends CiviUnitTestCase {
19
20 /**
21 * Sets up the fixture, for example, opens a network connection.
22 * This method is called before a test is executed.
23 */
24 protected function setUp() {
25 parent::setUp();
26 }
27
28 /**
29 * Tears down the fixture, for example, closes a network connection.
30 *
31 * This method is called after a test is executed.
32 */
33 protected function tearDown() {
34 }
35
36 public function testRetrieveTargetIdsByActivityIdZeroID() {
37 $this->activityCreate();
38 $target = CRM_Activity_BAO_ActivityTarget::retrieveTargetIdsByActivityId(0);
39 $this->assertSame($target, [], 'No targets returned');
40 }
41
42 public function testRetrieveTargetIdsByActivityIdOneID() {
43 $activity = $this->activityCreate();
44
45 $targetIDs = CRM_Activity_BAO_ActivityTarget::retrieveTargetIdsByActivityId($activity['id']);
46
47 // assert that we have at least one targetID
48 $this->assertEquals(count($targetIDs), 1, 'One target ID match for activity');
49 $this->assertEquals($targetIDs[0], $activity['target_contact_id'], 'The returned target contacts ids match');
50 }
51
52 }