Update copyright date for 2020
[civicrm-core.git] / tests / phpunit / api / v3 / TagTest.php
index b1df9ed2d3508c0dba75424308d3b4c10b8431a7..d5de5b5bfad29b3816c66d53c46658d358e57d5f 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019                                |
+ | Copyright CiviCRM LLC (c) 2004-2020                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -38,13 +38,13 @@ class api_v3_TagTest extends CiviUnitTestCase {
    * @var array
    * @ids array of values to be cleaned up in the tear down
    */
-  protected $ids = array();
+  protected $ids = [];
   /**
    * Tag id.
    *
    * @var int
    */
-  protected $tag = array();
+  protected $tag = [];
 
   protected $tagID;
 
@@ -64,7 +64,7 @@ class api_v3_TagTest extends CiviUnitTestCase {
    */
   public function testGetWrongParams($version) {
     $this->_apiversion = $version;
-    $params = array('name' => 'Wrong Tag Name');
+    $params = ['name' => 'Wrong Tag Name'];
     $result = $this->callAPISuccess('tag', 'get', $params);
     $this->assertEquals(0, $result['count']);
   }
@@ -76,10 +76,10 @@ class api_v3_TagTest extends CiviUnitTestCase {
    */
   public function testGet($version) {
     $this->_apiversion = $version;
-    $params = array(
+    $params = [
       'id' => $this->tagID,
       'name' => $this->tag['name'],
-    );
+    ];
     $result = $this->callAPIAndDocument('tag', 'get', $params, __FUNCTION__, __FILE__);
     $this->assertEquals($this->tag['description'], $result['values'][$this->tagID]['description']);
     $this->assertEquals($this->tag['name'], $result['values'][$this->tagID]['name']);
@@ -95,11 +95,11 @@ class api_v3_TagTest extends CiviUnitTestCase {
     $description = "Demonstrates use of Return as an array.";
     $subfile = "GetReturnArray";
 
-    $params = array(
+    $params = [
       'id' => $this->tagID,
       'name' => $this->tag['name'],
-      'return' => array('name'),
-    );
+      'return' => ['name'],
+    ];
     $result = $this->callAPIAndDocument('tag', 'get', $params, __FUNCTION__, __FILE__, $description, $subfile);
     $this->assertTrue(empty($result['values'][$this->tagID]['description']));
     $this->assertEquals($this->tag['name'], $result['values'][$this->tagID]['name']);
@@ -114,7 +114,7 @@ class api_v3_TagTest extends CiviUnitTestCase {
    */
   public function testCreateEmptyParams($version) {
     $this->_apiversion = $version;
-    $result = $this->callAPIFailure('tag', 'create', array(), 'name');
+    $result = $this->callAPIFailure('tag', 'create', [], 'name');
   }
 
   /**
@@ -124,11 +124,11 @@ class api_v3_TagTest extends CiviUnitTestCase {
    */
   public function testCreatePasstagInParams($version) {
     $this->_apiversion = $version;
-    $params = array(
+    $params = [
       'tag' => 10,
       'name' => 'New Tag23',
       'description' => 'This is description for New Tag 02',
-    );
+    ];
     $result = $this->callAPISuccess('tag', 'create', $params);
     $this->assertEquals(10, $result['id']);
   }
@@ -138,10 +138,10 @@ class api_v3_TagTest extends CiviUnitTestCase {
    * Skipping v4 because used_for is an array
    */
   public function testCreate() {
-    $params = array(
+    $params = [
       'name' => 'Super Heros',
       'description' => 'Outside undie-wearers',
-    );
+    ];
     $result = $this->callAPIAndDocument('tag', 'create', $params, __FUNCTION__, __FILE__);
     $this->assertNotNull($result['id']);
     $params['used_for'] = 'civicrm_contact';
@@ -156,13 +156,13 @@ class api_v3_TagTest extends CiviUnitTestCase {
    * Skipping v4 because used_for is an array
    */
   public function testCreateEntitySpecificTag() {
-    $params = array(
+    $params = [
       'name' => 'New Tag4',
       'description' => 'This is description for New Activity tag',
       'used_for' => 'civicrm_activity',
-    );
+    ];
     $result = $this->callAPISuccess('tag', 'create', $params);
-    $this->callAPISuccess('tag', 'get', array());
+    $this->callAPISuccess('tag', 'get', []);
     $this->getAndCheck($params, $result['id'], 'tag', 0, __FUNCTION__ . ' tag first created');
     unset($params['used_for']);
     $params['id'] = $result['id'];
@@ -180,7 +180,7 @@ class api_v3_TagTest extends CiviUnitTestCase {
    */
   public function testDeleteWithoutTagId($version) {
     $this->_apiversion = $version;
-    $result = $this->callAPIFailure('tag', 'delete', array());
+    $result = $this->callAPIFailure('tag', 'delete', []);
   }
 
   /**
@@ -190,9 +190,9 @@ class api_v3_TagTest extends CiviUnitTestCase {
    */
   public function testTagDeleteOldSyntax($version) {
     $this->_apiversion = $version;
-    $params = array(
+    $params = [
       'tag_id' => $this->tagID,
-    );
+    ];
     $result = $this->callAPISuccess('tag', 'delete', $params);
     unset($this->ids['tag']);
   }
@@ -204,26 +204,26 @@ class api_v3_TagTest extends CiviUnitTestCase {
    */
   public function testTagDeleteCorrectSyntax($version) {
     $this->_apiversion = $version;
-    $params = array(
+    $params = [
       'id' => $this->tagID,
-    );
+    ];
     $result = $this->callAPIAndDocument('tag', 'delete', $params, __FUNCTION__, __FILE__);
     unset($this->ids['tag']);
   }
 
   public function testTagGetfields() {
     $description = "Demonstrate use of getfields to interrogate api.";
-    $params = array('action' => 'create');
+    $params = ['action' => 'create'];
     $result = $this->callAPIAndDocument('tag', 'getfields', $params, __FUNCTION__, __FILE__, $description, NULL);
     $this->assertEquals('civicrm_contact', $result['values']['used_for']['api.default']);
   }
 
   public function testTagGetList() {
     $description = "Demonstrates use of api.getlist for autocomplete and quicksearch applications.";
-    $params = array(
+    $params = [
       'input' => $this->tag['name'],
-      'extra' => array('used_for'),
-    );
+      'extra' => ['used_for'],
+    ];
     $result = $this->callAPIAndDocument('tag', 'getlist', $params, __FUNCTION__, __FILE__, $description);
     $this->assertEquals($this->tag['id'], $result['values'][0]['id']);
     $this->assertEquals($this->tag['description'], $result['values'][0]['description'][0]);