Skip to content
Snippets Groups Projects
Commit 82adafa2 authored by eileen's avatar eileen
Browse files

locblock test fix broken as it was 'taking advantage of' inconsistency in return param

parent 7badfe57
No related branches found
No related tags found
No related merge requests found
......@@ -101,6 +101,7 @@ function civicrm_api3_loc_block_get($params) {
// If a return param has been set then fetch the appropriate fk objects
// This is a helper because api chaining does not work with a key like 'email_2'
if (!empty($options['return'])) {
unset($params['return']);
$values = array();
$items = array('address', 'email', 'phone', 'im');
$returnAll = !empty($options['return']['all']);
......
......@@ -4,7 +4,7 @@
*/
function loc_block_create_example(){
$params = array(
$params = array(
'version' => 3,
'address_id' => 2,
'phone_id' => 2,
......@@ -21,13 +21,13 @@ $params = array(
*/
function loc_block_create_expectedresult(){
$expectedResult = array(
$expectedResult = array(
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
'values' => array(
'2' => array(
'values' => array(
'2' => array(
'id' => '2',
'address_id' => '2',
'email_id' => '3',
......
......@@ -4,21 +4,21 @@
Create entities and location block in 1 api call
*/
function loc_block_createentities_example(){
$params = array(
$params = array(
'version' => 3,
'email' => array(
'email' => array(
'location_type_id' => 1,
'email' => 'test2@loc.block',
),
'phone' => array(
'phone' => array(
'location_type_id' => 1,
'phone' => '987654321',
),
'phone_2' => array(
'phone_2' => array(
'location_type_id' => 1,
'phone' => '456-7890',
),
'address' => array(
'address' => array(
'location_type_id' => 1,
'street_address' => '987654321',
),
......@@ -34,14 +34,14 @@ $params = array(
*/
function loc_block_createentities_expectedresult(){
$expectedResult = array(
$expectedResult = array(
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
'values' => array(
'3' => array(
'address' => array(
'values' => array(
'3' => array(
'address' => array(
'id' => '3',
'location_type_id' => '1',
'is_primary' => 0,
......@@ -49,7 +49,7 @@ function loc_block_createentities_expectedresult(){
'street_address' => '987654321',
'manual_geo_code' => 0,
),
'email' => array(
'email' => array(
'id' => '4',
'contact_id' => 'null',
'location_type_id' => '1',
......@@ -63,7 +63,7 @@ function loc_block_createentities_expectedresult(){
'signature_text' => '',
'signature_html' => '',
),
'phone' => array(
'phone' => array(
'id' => '3',
'contact_id' => 'null',
'location_type_id' => '1',
......@@ -75,7 +75,7 @@ function loc_block_createentities_expectedresult(){
'phone_numeric' => '',
'phone_type_id' => '',
),
'phone_2' => array(
'phone_2' => array(
'id' => '4',
'contact_id' => 'null',
'location_type_id' => '1',
......
......@@ -4,7 +4,7 @@
Get entities and location block in 1 api call
*/
function loc_block_get_example(){
$params = array(
$params = array(
'version' => 3,
'id' => 3,
'return' => 'all',
......@@ -20,13 +20,13 @@ $params = array(
*/
function loc_block_get_expectedresult(){
$expectedResult = array(
$expectedResult = array(
'id' => '3',
'address_id' => '3',
'email_id' => '4',
'phone_id' => '3',
'phone_2_id' => '4',
'address' => array(
'address' => array(
'id' => '3',
'location_type_id' => '1',
'is_primary' => 0,
......@@ -34,7 +34,7 @@ function loc_block_get_expectedresult(){
'street_address' => '987654321',
'manual_geo_code' => 0,
),
'email' => array(
'email' => array(
'id' => '4',
'location_type_id' => '1',
'email' => 'test2@loc.block',
......@@ -43,7 +43,7 @@ function loc_block_get_expectedresult(){
'on_hold' => 0,
'is_bulkmail' => 0,
),
'phone' => array(
'phone' => array(
'id' => '3',
'location_type_id' => '1',
'is_primary' => 0,
......@@ -51,7 +51,7 @@ function loc_block_get_expectedresult(){
'phone' => '987654321',
'phone_numeric' => '987654321',
),
'phone_2' => array(
'phone_2' => array(
'id' => '4',
'location_type_id' => '1',
'is_primary' => 0,
......
......@@ -99,7 +99,11 @@ class api_v3_LocBlockTest extends CiviUnitTestCase {
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
// Now check our results using the return param 'all'
$getParams = array('version' => $this->_apiversion, 'id' => $id, 'return' => 'all');
$getParams = array(
'version' => $this->_apiversion,
'id' => $id,
'return' => 'all'
);
$result = civicrm_api($this->_entity, 'getsingle', $getParams);
$this->documentMe($getParams, $result, __FUNCTION__, __FILE__, 'Get entities and location block in 1 api call', NULL, 'get');
$this->assertNotNull($result['email_id'], 'In line ' . __LINE__);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment