Commit | Line | Data |
---|---|---|
5b27a1fa CW |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
7d61e75f | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
5b27a1fa | 5 | | | |
7d61e75f TO |
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 | | |
5b27a1fa CW |
9 | +--------------------------------------------------------------------+ |
10 | */ | |
11 | ||
5b27a1fa CW |
12 | /** |
13 | * Test APIv3 ability to join across multiple entities | |
14 | * | |
15 | * @package CiviCRM_APIv3 | |
acb109b7 | 16 | * @group headless |
5b27a1fa CW |
17 | */ |
18 | class api_v3_EntityJoinTest extends CiviUnitTestCase { | |
19 | ||
20 | public function setUp() { | |
21 | parent::setUp(); | |
22 | $this->useTransaction(TRUE); | |
23 | } | |
24 | ||
25 | public function testJoinEmailToContact() { | |
26 | $first = 'firstthisisatest'; | |
27 | $last = 'lastthisisatest'; | |
9099cab3 CW |
28 | $org = $this->organizationCreate(['organization_name' => 'Employer of one']); |
29 | $person1 = $this->individualCreate(['employer_id' => $org, 'first_name' => $first, 'last_name' => $last, 'gender_id' => 1]); | |
30 | $person2 = $this->individualCreate([], 1); | |
31 | $result = $this->callAPISuccessGetSingle('Email', [ | |
9c846e15 | 32 | 'return' => 'contact_id.employer_id.display_name,contact_id.gender_id.label', |
5b27a1fa CW |
33 | 'contact_id.last_name' => $last, |
34 | 'contact_id.first_name' => $first, | |
9099cab3 | 35 | ]); |
5b27a1fa | 36 | $this->assertEquals('Employer of one', $result['contact_id.employer_id.display_name']); |
9c846e15 | 37 | $this->assertEquals('Female', $result['contact_id.gender_id.label']); |
5b27a1fa CW |
38 | } |
39 | ||
40 | } |