X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fapi%2Fv3%2FPriceSetTest.php;h=63edd734f1612dd8be6c868dd5fd8a42414136f6;hb=a335f6b228626e3e1b2f1549c8ddcbb9232b3c6b;hp=051143c53762c6290dc11e23b4c2a66a1fa996bd;hpb=2c53a8f729f160b603efc6e8f5eb03c118df6ed3;p=civicrm-core.git diff --git a/tests/phpunit/api/v3/PriceSetTest.php b/tests/phpunit/api/v3/PriceSetTest.php index 051143c537..63edd734f1 100644 --- a/tests/phpunit/api/v3/PriceSetTest.php +++ b/tests/phpunit/api/v3/PriceSetTest.php @@ -27,6 +27,10 @@ */ require_once 'CiviTest/CiviUnitTestCase.php'; + +/** + * Class api_v3_PriceSetTest + */ class api_v3_PriceSetTest extends CiviUnitTestCase { protected $_apiversion = 3; protected $_params; @@ -54,19 +58,34 @@ class api_v3_PriceSetTest extends CiviUnitTestCase { function tearDown() { } + /** + * + */ public function testCreatePriceSet() { $result = $this->callAPIAndDocument($this->_entity, 'create', $this->_params, __FUNCTION__, __FILE__); - $this->assertEquals(1, $result['count'], 'In line ' . __LINE__); - $this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__); + $this->assertEquals(1, $result['count']); + $this->assertNotNull($result['values'][$result['id']]['id']); $this->getAndCheck($this->_params, $result['id'], $this->_entity); } + /** + * Check that no name doesn't cause failure + */ + public function testCreatePriceSetNoName() { + $params = $this->_params; + unset($params['name']); + $result = $this->callAPISuccess($this->_entity, 'create', $params); + } + + /** + * + */ public function testGetBasicPriceSet() { $getParams = array( 'name' => 'default_contribution_amount', ); $getResult = $this->callAPIAndDocument($this->_entity, 'get', $getParams, __FUNCTION__, __FILE__); - $this->assertEquals(1, $getResult['count'], 'In line ' . __LINE__); + $this->assertEquals(1, $getResult['count']); } public function testEventPriceSet() { @@ -89,16 +108,16 @@ class api_v3_PriceSetTest extends CiviUnitTestCase { $result = $this->callAPISuccess($this->_entity, 'get', array( 'id' => $createResult['id'], )); - $this->assertEquals(array('civicrm_event' => array($event['id'])), $result['values'][$createResult['id']]['entity'], 'In line ' . __LINE__); + $this->assertEquals(array('civicrm_event' => array($event['id'])), $result['values'][$createResult['id']]['entity']); } public function testDeletePriceSet() { $startCount = $this->callAPISuccess($this->_entity, 'getcount', array()); $createResult = $this->callAPISuccess($this->_entity, 'create', $this->_params); $deleteParams = array('id' => $createResult['id']); - $deleteResult = $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__); + $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__); $endCount = $this->callAPISuccess($this->_entity, 'getcount', array()); - $this->assertEquals($startCount, $endCount, 'In line ' . __LINE__); + $this->assertEquals($startCount, $endCount); } public function testGetFieldsPriceSet() {