c039f658 |
1 | <?php |
2 | /* |
3 | +--------------------------------------------------------------------+ |
4 | | CiviCRM version 4.7 | |
5 | +--------------------------------------------------------------------+ |
6 | | Copyright CiviCRM LLC (c) 2004-2015 | |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | |
9 | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | |
11 | | under the terms of the GNU Affero General Public License | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | |
13 | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
17 | | See the GNU Affero General Public License for more details. | |
18 | | | |
19 | | You should have received a copy of the GNU Affero General Public | |
20 | | License and the CiviCRM Licensing Exception along | |
21 | | with this program; if not, contact CiviCRM LLC | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | |
25 | +--------------------------------------------------------------------+ |
26 | */ |
27 | |
c039f658 |
28 | /** |
29 | * Test class for CRM_Price_BAO_PriceSet. |
30 | */ |
31 | class CRM_Price_BAO_PriceSetTest extends CiviUnitTestCase { |
32 | |
33 | /** |
34 | * Sets up the fixtures. |
35 | */ |
36 | protected function setUp() { |
37 | parent::setUp(); |
38 | } |
39 | |
40 | /** |
41 | * Tears down the fixture. |
42 | */ |
43 | protected function tearDown() { |
44 | } |
45 | |
46 | /** |
47 | * Test the correct amount level is returned for an event which is not presented as a price set event. |
48 | * |
49 | * (these are denoted as 'quickConfig' in the code - but quickConfig is only supposed to refer to the |
50 | * configuration interface - there should be no different post process. |
51 | */ |
52 | public function testGetAmountLevelTextAmount() { |
53 | $priceSetID = $this->eventPriceSetCreate(9); |
54 | $priceSet = CRM_Price_BAO_PriceSet::getCachedPriceSetDetail($priceSetID); |
55 | $field = reset($priceSet['fields']); |
56 | $params = array('priceSetId' => $priceSetID, 'price_' . $field['id'] => 1); |
57 | $amountLevel = CRM_Price_BAO_PriceSet::getAmountLevelText($params); |
58 | $this->assertEquals(CRM_Core_DAO::VALUE_SEPARATOR . 'Price Field - 1' . CRM_Core_DAO::VALUE_SEPARATOR, $amountLevel); |
59 | } |
60 | |
61 | } |