Coding standards cleanup sprint.
[civicrm-core.git] / tests / phpunit / api / v3 / TagTest.php
index 6d2685ce2e586a67461085ce3e90f522390eb561..4f72a7e80d5d499d9f6f335e12e0c63aab961d54 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -31,34 +31,30 @@ require_once 'CiviTest/CiviUnitTestCase.php';
 /**
  *  Test APIv3 civicrm_tag_* functions
  *
- *  @package CiviCRM_APIv3
- *  @subpackage API_Core
+ * @package CiviCRM_APIv3
+ * @subpackage API_Core
  */
-
 class api_v3_TagTest extends CiviUnitTestCase {
-  protected $_apiversion =3;
+  protected $_apiversion = 3;
   /**
    * @ids array of values to be cleaned up in the tear down
    */
   protected $ids = array();
   /**
-   * tag id
+   * Tag id
    * @var integer
    */
   protected $tag = array();
 
   protected $tagID;
 
-  function setUp() {
+  public function setUp() {
     parent::setUp();
+    $this->useTransaction(TRUE);
     $this->tag = $this->tagCreate();
     $this->ids['tag'][] = $this->tagID = $this->tag['id'];
   }
 
-  function tearDown() {
-    $this->deleteFromIDSArray();
-  }
-
   ///////////////// civicrm_tag_get methods
   /**
    * Test civicrm_tag_get with wrong params.
@@ -87,7 +83,7 @@ class api_v3_TagTest extends CiviUnitTestCase {
    */
   public function testGetReturnArray() {
     $description = "demonstrates use of Return as an array";
-    $subfile     = "getReturnArray";
+    $subfile = "getReturnArray";
 
     $params = array(
       'id' => $this->tagID,
@@ -104,14 +100,14 @@ class api_v3_TagTest extends CiviUnitTestCase {
   /**
    * Test civicrm_tag_create with empty params.
    */
-  function testCreateEmptyParams() {
-    $result = $this->callAPIFailure('tag', 'create', array(),'Mandatory key(s) missing from params array: name');
+  public function testCreateEmptyParams() {
+    $result = $this->callAPIFailure('tag', 'create', array(), 'Mandatory key(s) missing from params array: name');
   }
 
   /**
    * Test civicrm_tag_create
    */
-  function testCreatePasstagInParams() {
+  public function testCreatePasstagInParams() {
     $params = array(
       'tag' => 10,
       'name' => 'New Tag23',
@@ -124,7 +120,7 @@ class api_v3_TagTest extends CiviUnitTestCase {
   /**
    * Test civicrm_tag_create - success expected.
    */
-  function testCreate() {
+  public function testCreate() {
     $params = array(
       'name' => 'Super Heros',
       'description' => 'Outside undie-wearers',
@@ -139,7 +135,7 @@ class api_v3_TagTest extends CiviUnitTestCase {
    * Test civicrm_tag_create activity tag- success expected. Test checks that used_for is set
    * and not over-written by default on update
    */
-  function testCreateEntitySpecificTag() {
+  public function testCreateEntitySpecificTag() {
     $params = array(
       'name' => 'New Tag4',
       'description' => 'This is description for New Activity tag',
@@ -159,14 +155,14 @@ class api_v3_TagTest extends CiviUnitTestCase {
   /**
    * Test civicrm_tag_delete without tag id.
    */
-  function testDeleteWithoutTagId() {
+  public function testDeleteWithoutTagId() {
     $result = $this->callAPIFailure('tag', 'delete', array(), 'Mandatory key(s) missing from params array: id');
   }
 
   /**
    * Test civicrm_tag_delete .
    */
-  function testTagDeleteOldSyntax() {
+  public function testTagDeleteOldSyntax() {
     $params = array(
       'tag_id' => $this->tagID,
     );
@@ -177,7 +173,7 @@ class api_v3_TagTest extends CiviUnitTestCase {
   /**
    * Test civicrm_tag_delete = $params['id'] is correct
    */
-  function testTagDeleteCorrectSyntax() {
+  public function testTagDeleteCorrectSyntax() {
     $params = array(
       'id' => $this->tagID,
     );
@@ -185,18 +181,18 @@ class api_v3_TagTest extends CiviUnitTestCase {
     unset($this->ids['tag']);
   }
 
-  function testTagGetfields() {
-    $description = "demonstrate use of getfields to interogate api";
-    $params      = array('action' => 'create');
-    $result      = $this->callAPIAndDocument('tag', 'getfields', $params, __FUNCTION__, __FILE__, $description, NULL, 'getfields');
+  public function testTagGetfields() {
+    $description = "demonstrate use of getfields to interrogate api";
+    $params = array('action' => 'create');
+    $result = $this->callAPIAndDocument('tag', 'getfields', $params, __FUNCTION__, __FILE__, $description, NULL, 'getfields');
     $this->assertEquals('civicrm_contact', $result['values']['used_for']['api.default']);
   }
 
-  function testTagGetList() {
+  public function testTagGetList() {
     $description = "Demonstrates use of api.getlist for autocomplete and quicksearch applications";
     $params = array(
       'input' => $this->tag['name'],
-      'extra' => array('used_for')
+      'extra' => array('used_for'),
     );
     $result = $this->callAPIAndDocument('tag', 'getlist', $params, __FUNCTION__, __FILE__, $description);
     $this->assertEquals($this->tag['id'], $result['values'][0]['id'], 'In line ' . __LINE__);
@@ -204,4 +200,3 @@ class api_v3_TagTest extends CiviUnitTestCase {
     $this->assertEquals($this->tag['used_for'], $result['values'][0]['extra']['used_for'], 'In line ' . __LINE__);
   }
 }
-