Add in Country and StateProvince APIv4 Entities
[civicrm-core.git] / tests / phpunit / api / v3 / WebsiteTest.php
index 7dd2e124adf90aa3b4b4dc426544cdd294a7a1d5..571f4bfa084c634f8589493987c190580d417033 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       |
  +--------------------------------------------------------------------+
  */
 
@@ -46,11 +30,11 @@ class api_v3_WebsiteTest extends CiviUnitTestCase {
 
     $this->_entity = 'website';
     $this->_contactID = $this->organizationCreate();
-    $this->params = array(
+    $this->params = [
       'contact_id' => $this->_contactID,
       'url' => 'website.com',
       'website_type_id' => 1,
-    );
+    ];
   }
 
   /**
@@ -75,7 +59,7 @@ class api_v3_WebsiteTest extends CiviUnitTestCase {
     $result = $this->callAPIAndDocument($this->_entity, 'get', $this->params, __FUNCTION__, __FILE__);
     $this->assertEquals(1, $result['count']);
     $this->assertNotNull($result['values'][$result['id']]['id']);
-    $this->callAPISuccess('website', 'delete', array('id' => $result['id']));
+    $this->callAPISuccess('website', 'delete', ['id' => $result['id']]);
   }
 
   /**
@@ -85,9 +69,9 @@ class api_v3_WebsiteTest extends CiviUnitTestCase {
   public function testDeleteWebsite($version) {
     $this->_apiversion = $version;
     $result = $this->callAPISuccess($this->_entity, 'create', $this->params);
-    $deleteParams = array('id' => $result['id']);
+    $deleteParams = ['id' => $result['id']];
     $result = $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__);
-    $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array());
+    $checkDeleted = $this->callAPISuccess($this->_entity, 'get', []);
     $this->assertEquals(0, $checkDeleted['count']);
   }
 
@@ -98,9 +82,9 @@ class api_v3_WebsiteTest extends CiviUnitTestCase {
   public function testDeleteWebsiteInvalid($version) {
     $this->_apiversion = $version;
     $result = $this->callAPISuccess($this->_entity, 'create', $this->params);
-    $deleteParams = array('id' => 600);
+    $deleteParams = ['id' => 600];
     $result = $this->callAPIFailure($this->_entity, 'delete', $deleteParams);
-    $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array());
+    $checkDeleted = $this->callAPISuccess($this->_entity, 'get', []);
     $this->assertEquals(1, $checkDeleted['count']);
   }
 
@@ -108,11 +92,11 @@ class api_v3_WebsiteTest extends CiviUnitTestCase {
    * Test retrieval of metadata.
    */
   public function testGetMetadata() {
-    $result = $this->callAPIAndDocument($this->_entity, 'get', array(
-      'options' => array(
-        'metadata' => array('fields'),
-      ),
-    ), __FUNCTION__, __FILE__, 'Demonostrates returning field metadata', 'GetWithMetadata');
+    $result = $this->callAPIAndDocument($this->_entity, 'get', [
+      'options' => [
+        'metadata' => ['fields'],
+      ],
+    ], __FUNCTION__, __FILE__, 'Demonostrates returning field metadata', 'GetWithMetadata');
     $this->assertEquals('Website', $result['metadata']['fields']['url']['title']);
   }
 
@@ -122,7 +106,7 @@ class api_v3_WebsiteTest extends CiviUnitTestCase {
    */
   public function testGetFields($version) {
     $this->_apiversion = $version;
-    $result = $this->callAPIAndDocument($this->_entity, 'getfields', array('action' => 'get'), __FUNCTION__, __FILE__);
+    $result = $this->callAPIAndDocument($this->_entity, 'getfields', ['action' => 'get'], __FUNCTION__, __FILE__);
     $this->assertArrayKeyExists('url', $result['values']);
   }