<?php
/*
+--------------------------------------------------------------------+
-| CiviCRM version 4.5 |
+| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
protected $id = 0;
protected $contactIds = array();
protected $_entity = 'line_item';
- protected $contribution_result = null;
+ protected $contribution_result = NULL;
public $DBResetRequired = TRUE;
protected $_financialTypeId = 1;
public function setUp() {
parent::setUp();
+ $this->useTransaction(TRUE);
$this->_individualId = $this->individualCreate();
$contributionParams = array(
'contact_id' => $this->_individualId,
'source' => 'SSF',
'contribution_status_id' => 1,
);
- $contribution = $this->callAPISuccess('contribution','create', $contributionParams);
+ $contribution = $this->callAPISuccess('contribution', 'create', $contributionParams);
$this->params = array(
'price_field_value_id' => 1,
'price_field_id' => 1,
);
}
- function tearDown() {
-
- foreach ($this->contactIds as $id) {
- $this->callAPISuccess('contact', 'delete', array('id' => $id));
- }
- $this->quickCleanup(
- array(
- 'civicrm_contact',
- 'civicrm_contribution',
- 'civicrm_line_item',
- )
- );
- }
-
public function testCreateLineItem() {
- $this->quickCleanup(
- array(
- 'civicrm_line_item',
- )
- );
$result = $this->callAPIAndDocument($this->_entity, 'create', $this->params + array('debug' => 1), __FUNCTION__, __FILE__);
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
$this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__);
}
public function testDeleteLineItem() {
- $getParams = array( 'entity_table' => 'civicrm_contribution',
+ $getParams = array(
+ 'entity_table' => 'civicrm_contribution',
);
$getResult = $this->callAPISuccess($this->_entity, 'get', $getParams);
$deleteParams = array('id' => $getResult['id']);
}
public function testGetFieldsLineItem() {
- $result = $this->callAPISuccess($this->_entity, 'getfields', array('action' => 'create',));
+ $result = $this->callAPISuccess($this->_entity, 'getfields', array('action' => 'create'));
$this->assertEquals(1, $result['values']['entity_id']['api.required']);
}
- public static function setUpBeforeClass() {
- // put stuff here that should happen before all tests in this unit
- }
-
- public static function tearDownAfterClass(){
- $tablesToTruncate = array(
- 'civicrm_contact',
- 'civicrm_financial_type',
- 'civicrm_contribution',
- 'civicrm_line_item',
- );
- $unitTest = new CiviUnitTestCase();
- $unitTest->quickCleanup($tablesToTruncate);
- }
}
-