3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
28 require_once 'CiviTest/CiviUnitTestCase.php';
31 * Class CRM_Contribute_BAO_ManagePremiumsTest
33 class CRM_Contribute_BAO_ManagePremiumsTest
extends CiviUnitTestCase
{
39 'name' => 'ManagePremiums BAOs',
40 'description' => 'Test all Contribute_BAO_Contribution methods.',
41 'group' => 'CiviCRM BAO Tests',
55 'name' => 'Test Product',
57 'imageOption' => 'noImage',
60 'min_contribution' => 5,
64 $product = CRM_Contribute_BAO_ManagePremiums
::add($params, $ids);
66 $result = $this->assertDBNotNull('CRM_Contribute_BAO_ManagePremiums', $product->id
,
68 'Database check on updated product record.'
71 $this->assertEquals($result, 'TP-10', 'Verify products sku.');
75 * check method retrieve( )
77 function testRetrieve() {
80 'name' => 'Test Product',
82 'imageOption' => 'noImage',
85 'min_contribution' => 5,
89 $product = CRM_Contribute_BAO_ManagePremiums
::add($params, $ids);
90 $params = array('id' => $product->id
);
92 $result = CRM_Contribute_BAO_ManagePremiums
::retrieve($params, $default);
93 $this->assertEquals(empty($result), FALSE, 'Verify products record.');
97 * check method setIsActive( )
99 function testSetIsActive() {
102 'name' => 'Test Product',
104 'imageOption' => 'noImage',
107 'min_contribution' => 5,
111 $product = CRM_Contribute_BAO_ManagePremiums
::add($params, $ids);
112 CRM_Contribute_BAO_ManagePremiums
::setIsActive($product->id
, 0);
114 $isActive = $this->assertDBNotNull('CRM_Contribute_BAO_ManagePremiums', $product->id
,
116 'Database check on updated for product records is_active.'
119 $this->assertEquals($isActive, 0, 'Verify product records is_active.');
123 * check method del( )
128 'name' => 'Test Product',
130 'imageOption' => 'noImage',
133 'min_contribution' => 5,
137 $product = CRM_Contribute_BAO_ManagePremiums
::add($params, $ids);
139 CRM_Contribute_BAO_ManagePremiums
::del($product->id
);
141 $params = array('id' => $product->id
);
143 $result = CRM_Contribute_BAO_ManagePremiums
::retrieve($params, $defaults);
145 $this->assertEquals(empty($result), TRUE, 'Verify product record deletion.');