CRM-19286 - add unit test to avoid future problems with surveys.
authorJamie McClelland <jm@mayfirst.org>
Tue, 6 Sep 2016 15:12:02 +0000 (11:12 -0400)
committerJamie McClelland <jm@mayfirst.org>
Tue, 6 Sep 2016 15:12:02 +0000 (11:12 -0400)
tests/phpunit/api/v3/UFJoinTest.php

index caa48e64110e0f523d715060a9a9fbcdfed6c2a9..8137d20661ed9f9457dce3f25d59512dbb25331c 100644 (file)
@@ -156,6 +156,25 @@ class api_v3_UFJoinTest extends CiviUnitTestCase {
     $this->assertEquals($ufJoinUpdated['values'][0]['is_active'], $params['is_active']);
   }
 
+  /**
+   * Ensure we can create a survey join which is less common than event or contribution
+   * joins.
+   */
+  public function testCreateSurveyUFJoin() {
+    $params = array(
+      'module' => 'CiviCampaign',
+      'entity_table' => 'civicrm_survey',
+      'entity_id' => 1,
+      'weight' => 1,
+      'uf_group_id' => $this->_ufGroupId,
+      'is_active' => 1,
+      'sequential' => 1,
+    );
+    $ufJoin = $this->callAPIAndDocument('uf_join', 'create', $params, __FUNCTION__, __FILE__);
+    $this->assertEquals($ufJoin['values'][0]['module'], $params['module']);
+    $this->assertEquals($ufJoin['values'][0]['uf_group_id'], $params['uf_group_id']);
+    $this->assertEquals($ufJoin['values'][0]['is_active'], $params['is_active']);
+  }
 
   public function testFindUFJoinWrongParamsType() {
     $params = 'a string';