From a72f0e58a712758d00d4090d27b601bcca53225b Mon Sep 17 00:00:00 2001 From: Johan Vervloet Date: Mon, 24 Nov 2014 12:11:05 +0100 Subject: [PATCH] CRM-15636: API Unit test: price set for events and contributions. ---------------------------------------- * CRM-15636: Using the API to create a price set for both events and contributions. https://issues.civicrm.org/jira/browse/CRM-15636 --- tests/phpunit/api/v3/PriceSetTest.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/phpunit/api/v3/PriceSetTest.php b/tests/phpunit/api/v3/PriceSetTest.php index 63edd734f1..985edf0517 100644 --- a/tests/phpunit/api/v3/PriceSetTest.php +++ b/tests/phpunit/api/v3/PriceSetTest.php @@ -68,6 +68,29 @@ class api_v3_PriceSetTest extends CiviUnitTestCase { $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 */ -- 2.25.1