Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
81621fee | 4 | | CiviCRM version 4.7 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
e7112fa7 | 6 | | Copyright CiviCRM LLC (c) 2004-2015 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
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. | | |
13 | | | | |
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. | | |
18 | | | | |
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 | +--------------------------------------------------------------------+ | |
d25dd0ee | 26 | */ |
6a488035 TO |
27 | |
28 | ||
29 | require_once 'CiviTest/CiviUnitTestCase.php'; | |
30 | ||
31 | /** | |
32 | * Test class for CRM_Activity_BAO_ActivityTarget BAO | |
33 | * | |
6c6e6187 | 34 | * @package CiviCRM |
6a488035 TO |
35 | */ |
36 | class CRM_Activity_BAO_ActivityTargetTest extends CiviUnitTestCase { | |
37 | ||
38 | /** | |
39 | * Sets up the fixture, for example, opens a network connection. | |
40 | * This method is called before a test is executed. | |
6a488035 TO |
41 | */ |
42 | protected function setUp() { | |
43 | parent::setUp(); | |
44 | } | |
45 | ||
46 | /** | |
47 | * Tears down the fixture, for example, closes a network connection. | |
fe482240 | 48 | * |
6a488035 | 49 | * This method is called after a test is executed. |
6a488035 | 50 | */ |
6c6e6187 TO |
51 | protected function tearDown() { |
52 | } | |
6a488035 TO |
53 | |
54 | public function testRetrieveTargetIdsByActivityIdZeroID() { | |
fe482240 | 55 | $this->activityCreate(); |
6a488035 TO |
56 | $target = CRM_Activity_BAO_ActivityTarget::retrieveTargetIdsByActivityId(0); |
57 | $this->assertSame($target, array(), 'No targets returned'); | |
58 | } | |
59 | ||
60 | ||
61 | public function testRetrieveTargetIdsByActivityIdOneID() { | |
62 | $activity = $this->activityCreate(); | |
63 | ||
64 | $targetIDs = CRM_Activity_BAO_ActivityTarget::retrieveTargetIdsByActivityId($activity['id']); | |
65 | ||
66 | // assert that we have at least one targetID | |
67 | $this->assertEquals(count($targetIDs), 1, 'One target ID match for activity'); | |
68 | $this->assertEquals($targetIDs[0], $activity['target_contact_id'], 'The returned target contacts ids match'); | |
69 | } | |
96025800 | 70 | |
6a488035 | 71 | } |