<?php
-
/*
+--------------------------------------------------------------------+
-| CiviCRM version 4.5 |
+| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
protected $_entity = 'price_set';
public $DBResetRequired = TRUE;
+
public function setUp() {
parent::setUp();
$this->_params = array(
-# [domain_id] =>
+ # [domain_id] =>
'name' => 'default_goat_priceset',
'title' => 'Goat accessories',
'is_active' => 1,
);
}
- function tearDown() {
+ public function tearDown() {
}
/**
- *
*/
public function testCreatePriceSet() {
$result = $this->callAPIAndDocument($this->_entity, 'create', $this->_params, __FUNCTION__, __FILE__);
$this->getAndCheck($this->_params, $result['id'], $this->_entity);
}
+ /**
+ * Test for creating price sets used for both events and contributions.
+ */
+ public function testCreatePriceSetForEventAndContribution() {
+ // Create the price set
+ $createParams = array(
+ 'name' => 'some_price_set',
+ 'title' => 'Some Price Set',
+ 'is_active' => 1,
+ 'financial_type_id' => 1,
+ 'extends' => array(1, 2),
+ );
+ $createResult = $this->callAPIAndDocument($this->_entity, 'create', $createParams, __FUNCTION__, __FILE__);
+
+ // Get priceset we just created.
+ $result = $this->callAPISuccess($this->_entity, 'getSingle', array(
+ 'id' => $createResult['id'],
+ ));
+
+ // Count the number of items in 'extends'.
+ $this->assertEquals(2, count($result['extends']));
+ }
+
/**
* Check that no name doesn't cause failure
*/
}
/**
- *
*/
public function testGetBasicPriceSet() {
$getParams = array(
}
public static function setUpBeforeClass() {
- // put stuff here that should happen before all tests in this unit
+ // put stuff here that should happen before all tests in this unit
}
- public static function tearDownAfterClass(){
+ public static function tearDownAfterClass() {
$tablesToTruncate = array(
'civicrm_contact',
'civicrm_contribution',
$unitTest->quickCleanup($tablesToTruncate);
}
}
-