From 5b27a1fa853d934606b70d5c81e03a6b15bb05ec Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 8 Jan 2016 23:05:59 -0500 Subject: [PATCH] CRM-17795 - Add unit test for api joins --- tests/phpunit/api/v3/EntityJoinTest.php | 56 +++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 tests/phpunit/api/v3/EntityJoinTest.php diff --git a/tests/phpunit/api/v3/EntityJoinTest.php b/tests/phpunit/api/v3/EntityJoinTest.php new file mode 100644 index 0000000000..4b596f6d48 --- /dev/null +++ b/tests/phpunit/api/v3/EntityJoinTest.php @@ -0,0 +1,56 @@ +useTransaction(TRUE); + } + + public function testJoinEmailToContact() { + $first = 'firstthisisatest'; + $last = 'lastthisisatest'; + $org = $this->organizationCreate(array('organization_name' => 'Employer of one')); + $person1 = $this->individualCreate(array('employer_id' => $org, 'first_name' => $first, 'last_name' => $last)); + $person2 = $this->individualCreate(array(), 1); + $result = $this->callAPISuccessGetSingle('Email', array( + 'return' => 'contact_id.employer_id.display_name', + 'contact_id.last_name' => $last, + 'contact_id.first_name' => $first, + )); + $this->assertEquals('Employer of one', $result['contact_id.employer_id.display_name']); + } + +} -- 2.25.1