<?php
/*
+--------------------------------------------------------------------+
-| CiviCRM version 4.4 |
+| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
-| 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_PriceFieldTest
+ */
class api_v3_PriceFieldTest extends CiviUnitTestCase {
protected $_apiversion = 3;
protected $_params;
parent::setUp();
// put stuff here that should happen before all tests in this unit
$priceSetparams = array(
- # [domain_id] =>
+ # [domain_id] =>
'name' => 'default_goat_priceset',
'title' => 'Goat accomodation',
'is_active' => 1,
'is_reserved' => 1,
);
- $price_set = $this->callAPISuccess('price_set', 'create',$priceSetparams);
+ $price_set = $this->callAPISuccess('price_set', 'create', $priceSetparams);
$this->priceSetID = $price_set['id'];
- $this->_params = array( 'price_set_id' => $this->priceSetID,
+ $this->_params = array(
+ 'price_set_id' => $this->priceSetID,
'name' => 'grassvariety',
'label' => 'Grass Variety',
'html_type' => 'Text',
);
}
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array(
- 'civicrm_contact',
- 'civicrm_contribution',
+ 'civicrm_contact',
+ 'civicrm_contribution',
);
$this->quickCleanup($tablesToTruncate);
- $delete = $this->callAPISuccess('PriceSet','delete', array(
- 'id' => $this->priceSetID,
+ $delete = $this->callAPISuccess('PriceSet', 'delete', array(
+ 'id' => $this->priceSetID,
));
$this->assertAPISuccess($delete);
);
$getResult = $this->callAPIAndDocument($this->_entity, 'get', $getParams, __FUNCTION__, __FILE__);
$this->assertEquals(1, $getResult['count'], 'In line ' . __LINE__);
- $this->callAPISuccess('price_field','delete', array('id' => $createResult['id']));
+ $this->callAPISuccess('price_field', 'delete', array('id' => $createResult['id']));
}
public function testDeletePriceField() {
- $startCount = $this->callAPISuccess($this->_entity, 'getcount', array( ));
+ $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->assertAPISuccess($deleteResult, 'In line ' . __LINE__);
- $endCount = $this->callAPISuccess($this->_entity, 'getcount', array( ));
+ $endCount = $this->callAPISuccess($this->_entity, 'getcount', array());
$this->assertEquals($startCount, $endCount, 'In line ' . __LINE__);
}
}
}
-