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 APIv3 ability to join across multiple entities
15 * @package CiviCRM_APIv3
18 class api_v3_EntityJoinTest
extends CiviUnitTestCase
{
20 public function setUp() {
22 $this->useTransaction(TRUE);
25 public function testJoinEmailToContact() {
26 $first = 'firstthisisatest';
27 $last = 'lastthisisatest';
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', [
32 'return' => 'contact_id.employer_id.display_name,contact_id.gender_id.label',
33 'contact_id.last_name' => $last,
34 'contact_id.first_name' => $first,
36 $this->assertEquals('Employer of one', $result['contact_id.employer_id.display_name']);
37 $this->assertEquals('Female', $result['contact_id.gender_id.label']);