Merge branch 'master' into master-civimail-abtest
[civicrm-core.git] / tests / phpunit / api / v3 / PriceSetTest.php
index 29bada876cb84d87edee9646967feb47a093decf..63edd734f1612dd8be6c868dd5fd8a42414136f6 100644 (file)
@@ -2,9 +2,9 @@
 
 /*
  +--------------------------------------------------------------------+
-| CiviCRM version 4.4                                                |
+| CiviCRM version 4.5                                                |
 +--------------------------------------------------------------------+
-| Copyright CiviCRM LLC (c) 2004-2013                                |
+| Copyright CiviCRM LLC (c) 2004-2014                                |
 +--------------------------------------------------------------------+
 | This file is a part of CiviCRM.                                    |
 |                                                                    |
 */
 
 require_once 'CiviTest/CiviUnitTestCase.php';
+
+/**
+ * Class api_v3_PriceSetTest
+ */
 class api_v3_PriceSetTest extends CiviUnitTestCase {
   protected $_apiversion = 3;
   protected $_params;
@@ -54,19 +58,34 @@ class api_v3_PriceSetTest extends CiviUnitTestCase {
   function tearDown() {
   }
 
+  /**
+   *
+   */
   public function testCreatePriceSet() {
     $result = $this->callAPIAndDocument($this->_entity, 'create', $this->_params, __FUNCTION__, __FILE__);
-    $this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
-    $this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__);
+    $this->assertEquals(1, $result['count']);
+    $this->assertNotNull($result['values'][$result['id']]['id']);
     $this->getAndCheck($this->_params, $result['id'], $this->_entity);
   }
 
+  /**
+   * Check that no name doesn't cause failure
+   */
+  public function testCreatePriceSetNoName() {
+    $params = $this->_params;
+    unset($params['name']);
+    $result = $this->callAPISuccess($this->_entity, 'create', $params);
+  }
+
+  /**
+   *
+   */
   public function testGetBasicPriceSet() {
     $getParams = array(
       'name' => 'default_contribution_amount',
     );
     $getResult = $this->callAPIAndDocument($this->_entity, 'get', $getParams, __FUNCTION__, __FILE__);
-    $this->assertEquals(1, $getResult['count'], 'In line ' . __LINE__);
+    $this->assertEquals(1, $getResult['count']);
   }
 
   public function testEventPriceSet() {
@@ -89,16 +108,16 @@ class api_v3_PriceSetTest extends CiviUnitTestCase {
     $result = $this->callAPISuccess($this->_entity, 'get', array(
       'id' => $createResult['id'],
     ));
-    $this->assertEquals(array('civicrm_event' => array($event['id'])), $result['values'][$createResult['id']]['entity'], 'In line ' . __LINE__);
+    $this->assertEquals(array('civicrm_event' => array($event['id'])), $result['values'][$createResult['id']]['entity']);
   }
 
   public function testDeletePriceSet() {
     $startCount = $this->callAPISuccess($this->_entity, 'getcount', array());
     $createResult = $this->callAPISuccess($this->_entity, 'create', $this->_params);
     $deleteParams = array('id' => $createResult['id']);
-    $deleteResult = $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__);
+    $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__);
     $endCount = $this->callAPISuccess($this->_entity, 'getcount', array());
-    $this->assertEquals($startCount, $endCount, 'In line ' . __LINE__);
+    $this->assertEquals($startCount, $endCount);
   }
 
   public function testGetFieldsPriceSet() {