From 6f7365219198ee980434aeb96d39197c2fda3d3a Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 13 Oct 2016 10:18:05 -0400 Subject: [PATCH] CRM-19500 - Fix api runAuthorize --- Civi/API/Kernel.php | 2 +- tests/phpunit/api/v3/AddressTest.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Civi/API/Kernel.php b/Civi/API/Kernel.php index 688b588591..2542d9aeec 100644 --- a/Civi/API/Kernel.php +++ b/Civi/API/Kernel.php @@ -130,7 +130,7 @@ class Kernel { $apiRequest = Request::create($entity, $action, $params, $extra); try { - $this->boot(); + $this->boot($apiRequest); list($apiProvider, $apiRequest) = $this->resolve($apiRequest); $this->authorize($apiProvider, $apiRequest); return TRUE; diff --git a/tests/phpunit/api/v3/AddressTest.php b/tests/phpunit/api/v3/AddressTest.php index a721c83a92..72b0f60cae 100644 --- a/tests/phpunit/api/v3/AddressTest.php +++ b/tests/phpunit/api/v3/AddressTest.php @@ -348,4 +348,20 @@ class api_v3_AddressTest extends CiviUnitTestCase { $this->callAPISuccess('address', 'delete', array('id' => $address1['id'])); } + public function testGetWithJoin() { + $cid = $this->individualCreate(array( + 'api.Address.create' => array( + 'street_address' => __FUNCTION__, + 'location_type_id' => $this->_locationType->id, + ), + )); + $result = $this->callAPISuccess('address', 'getsingle', array( + 'check_permissions' => TRUE, + 'contact_id' => $cid, + 'street_address' => __FUNCTION__, + 'return' => 'contact_id.contact_type', + )); + $this->assertEquals('Individual', $result['contact_id.contact_type']); + } + } -- 2.25.1