From: eileen Date: Mon, 16 May 2016 22:59:03 +0000 (+1200) Subject: CRM-18517 add test for aggressive mode batch merge X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=99140301474e2d94a17bd40774dae1dd19a1dc15;p=civicrm-core.git CRM-18517 add test for aggressive mode batch merge Change-Id: I198577b3073239b298a47ca6f649f6a6c92dcb13 --- diff --git a/tests/phpunit/api/v3/JobTest.php b/tests/phpunit/api/v3/JobTest.php index 4b741316b3..718f653a45 100644 --- a/tests/phpunit/api/v3/JobTest.php +++ b/tests/phpunit/api/v3/JobTest.php @@ -317,7 +317,7 @@ class api_v3_JobTest extends CiviUnitTestCase { $this->callAPISuccess('Contact', 'create', $params); } - $result = $this->callAPISuccess('Job', 'process_batch_merge', array()); + $result = $this->callAPISuccess('Job', 'process_batch_merge', array('mode' => $dataSet['mode'])); $this->assertEquals($dataSet['skipped'], count($result['values']['skipped']), 'Failed to skip the right number:' . $dataSet['skipped']); $this->assertEquals($dataSet['merged'], count($result['values']['merged'])); $result = $this->callAPISuccess('Contact', 'get', array('contact_sub_type' => 'Student', 'sequential' => 1)); @@ -329,6 +329,13 @@ class api_v3_JobTest extends CiviUnitTestCase { } } + /** + * Test that in aggressive mode our conflicted contacts are merged. + */ + public function testBatchMergeAggressive() { + + } + /** * Get data for batch merge. */ @@ -336,6 +343,7 @@ class api_v3_JobTest extends CiviUnitTestCase { $data = array( array( array( + 'mode' => 'safe', 'contacts' => array( array( 'first_name' => 'Michael', @@ -370,6 +378,7 @@ class api_v3_JobTest extends CiviUnitTestCase { ), array( array( + 'mode' => 'safe', 'contacts' => array( array( 'first_name' => 'Michael', @@ -414,6 +423,46 @@ class api_v3_JobTest extends CiviUnitTestCase { ), ), ), + array( + array( + 'mode' => 'aggressive', + 'contacts' => array( + array( + 'first_name' => 'Michael', + 'last_name' => 'Jackson', + 'email' => 'michael@neverland.com', + 'contact_type' => 'Individual', + 'contact_sub_type' => 'Student', + 'api.Address.create' => array( + 'street_address' => 'big house', + 'location_type_id' => 'Home', + ), + ), + array( + 'first_name' => 'Michael', + 'last_name' => 'Jackson', + 'email' => 'michael@neverland.com', + 'contact_type' => 'Individual', + 'contact_sub_type' => 'Student', + 'api.Address.create' => array( + 'street_address' => 'bigger house', + 'location_type_id' => 'Home', + ), + ), + ), + 'skipped' => 0, + 'merged' => 1, + 'expected' => array( + array( + 'first_name' => 'Michael', + 'last_name' => 'Jackson', + 'email' => 'michael@neverland.com', + 'contact_type' => 'Individual', + 'street_address' => 'big house', + ), + ), + ) + ), ); return $data; }