Add in Country and StateProvince APIv4 Entities
[civicrm-core.git] / tests / phpunit / api / v3 / UFGroupTest.php
index a2f3d0e9751b9330b679758572162ff9d589a16c..8d10ba5cf3003e8ce538d963af42d23509a48ef4 100644 (file)
@@ -1,27 +1,11 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
+ | Copyright CiviCRM LLC. All rights reserved.                        |
  |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ | This work is published under the GNU AGPLv3 license with some      |
+ | permitted exceptions and without any warranty. For full license    |
+ | and copyright information, see https://civicrm.org/licensing       |
  +--------------------------------------------------------------------+
  */
 
@@ -48,19 +32,19 @@ class api_v3_UFGroupTest extends CiviUnitTestCase {
     $this->_groupId = $this->groupCreate();
     $this->_contactId = $this->individualCreate();
     $this->createLoggedInUser();
-    $ufGroup = $this->callAPISuccess('uf_group', 'create', array(
+    $ufGroup = $this->callAPISuccess('uf_group', 'create', [
       'group_type' => 'Contact',
       'help_pre' => 'Profile to Test API',
       'title' => 'Test Profile',
-    ));
+    ]);
     $this->_ufGroupId = $ufGroup['id'];
-    $ufMatch = $this->callAPISuccess('uf_match', 'create', array(
+    $ufMatch = $this->callAPISuccess('uf_match', 'create', [
       'contact_id' => $this->_contactId,
       'uf_id' => 42,
       'uf_name' => 'email@mail.com',
-    ));
+    ]);
     $this->_ufMatchId = $ufMatch['id'];
-    $this->params = array(
+    $this->params = [
       'add_captcha' => 1,
       'add_contact_to_group' => $this->_groupId,
       'group' => $this->_groupId,
@@ -81,19 +65,19 @@ class api_v3_UFGroupTest extends CiviUnitTestCase {
       'notify' => 'admin@example.org',
       'post_URL' => 'http://example.org/post',
       'title' => 'Test Group',
-    );
+    ];
   }
 
   public function tearDown() {
     //  Truncate the tables
     $this->quickCleanup(
-      array(
+      [
         'civicrm_group',
         'civicrm_contact',
         'civicrm_uf_group',
         'civicrm_uf_join',
         'civicrm_uf_match',
-      )
+      ]
     );
   }
 
@@ -103,12 +87,12 @@ class api_v3_UFGroupTest extends CiviUnitTestCase {
    */
   public function testUpdateUFGroup($version) {
     $this->_apiversion = $version;
-    $params = array(
+    $params = [
       'title' => 'Edited Test Profile',
       'help_post' => 'Profile Pro help text.',
       'is_active' => 1,
       'id' => $this->_ufGroupId,
-    );
+    ];
 
     $result = $this->callAPISuccess('uf_group', 'create', $params);
     foreach ($params as $key => $value) {
@@ -143,7 +127,7 @@ class api_v3_UFGroupTest extends CiviUnitTestCase {
    */
   public function testUFGroupCreateWithWrongParams($version) {
     $this->_apiversion = $version;
-    $result = $this->callAPIFailure('uf_group', 'create', array('name' => 'A title-less group'));
+    $result = $this->callAPIFailure('uf_group', 'create', ['name' => 'A title-less group']);
   }
 
   /**
@@ -152,7 +136,7 @@ class api_v3_UFGroupTest extends CiviUnitTestCase {
    */
   public function testUFGroupUpdate($version) {
     $this->_apiversion = $version;
-    $params = array(
+    $params = [
       'id' => $this->_ufGroupId,
       'add_captcha' => 1,
       'add_contact_to_group' => $this->_groupId,
@@ -174,7 +158,7 @@ class api_v3_UFGroupTest extends CiviUnitTestCase {
       'notify' => 'admin@example.org',
       'post_URL' => 'http://example.org/post',
       'title' => 'Test Group',
-    );
+    ];
     $result = $this->callAPISuccess('uf_group', 'create', $params);
     $params['created_date'] = date('YmdHis', strtotime($params['created_date']));
     foreach ($params as $key => $value) {
@@ -195,7 +179,7 @@ class api_v3_UFGroupTest extends CiviUnitTestCase {
   public function testUFGroupGet($version) {
     $this->_apiversion = $version;
     $result = $this->callAPISuccess('uf_group', 'create', $this->params);
-    $params = array('id' => $result['id']);
+    $params = ['id' => $result['id']];
     $result = $this->callAPIAndDocument('uf_group', 'get', $params, __FUNCTION__, __FILE__);
     $this->assertEquals($result['values'][$result['id']]['add_to_group_id'], $this->params['add_contact_to_group']);
     $this->assertEquals($result['values'][$result['id']]['limit_listings_group_id'], $this->params['group']);
@@ -230,7 +214,7 @@ class api_v3_UFGroupTest extends CiviUnitTestCase {
   public function testUFGroupDelete($version) {
     $this->_apiversion = $version;
     $ufGroup = $this->callAPISuccess('uf_group', 'create', $this->params);
-    $params = array('id' => $ufGroup['id']);
+    $params = ['id' => $ufGroup['id']];
     $this->assertEquals(1, $this->callAPISuccess('uf_group', 'getcount', $params), "in line " . __LINE__);
     $result = $this->callAPIAndDocument('uf_group', 'delete', $params, __FUNCTION__, __FILE__);
     $this->assertEquals(0, $this->callAPISuccess('uf_group', 'getcount', $params), "in line " . __LINE__);