From 78373706573216ff5ff8209bfad2080d0b931369 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 2 Feb 2015 23:24:59 +1300 Subject: [PATCH] fix for previously introduced format issue + more comment fixes --- api/v3/ContributionSoft.php | 4 +-- api/v3/MailingEventUnsubscribe.php | 2 +- tests/phpunit/CiviTest/CiviUnitTestCase.php | 18 ++++++---- tests/phpunit/api/v3/PriceFieldValueTest.php | 36 +++++++++++++------- 4 files changed, 37 insertions(+), 23 deletions(-) diff --git a/api/v3/ContributionSoft.php b/api/v3/ContributionSoft.php index 8805cfedc3..8d6187cf7c 100644 --- a/api/v3/ContributionSoft.php +++ b/api/v3/ContributionSoft.php @@ -1,6 +1,4 @@ 0 - * else provide full message + * Check that api returned 'is_error' => 0. + * * @param array $apiResult * Api result. * @param string $prefix @@ -831,8 +833,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { } /** - * Check that api returned 'is_error' => 1 - * else provide full message + * Check that api returned 'is_error' => 1. * * @param array $apiResult * Api result. @@ -861,7 +862,8 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { } /** - * Check that a deleted item has been deleted + * Check that a deleted item has been deleted. + * * @param $entity * @param $id */ @@ -2242,9 +2244,11 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { /** * Create test generated example in api/v3/examples. + * * To turn this off (e.g. on the server) set * define(DONT_DOCUMENT_TEST_CONFIG ,1); * in your settings file + * * @param array $params * Array as passed to civicrm_api function. * @param array $result diff --git a/tests/phpunit/api/v3/PriceFieldValueTest.php b/tests/phpunit/api/v3/PriceFieldValueTest.php index 3d87b19f71..d6434bca36 100644 --- a/tests/phpunit/api/v3/PriceFieldValueTest.php +++ b/tests/phpunit/api/v3/PriceFieldValueTest.php @@ -39,13 +39,20 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase { public $DBResetRequired = TRUE; + /** + * @var int + */ + protected $priceFieldID; + + /** + * Setup function. + */ public function setUp() { parent::setUp(); - // put stuff here that should happen before all tests in this unit - $priceSetparams = array( - # [domain_id] => + // Put stuff here that should happen before all tests in this unit. + $priceSetParams = array( 'name' => 'default_goat_priceset', - 'title' => 'Goat accomodation', + 'title' => 'Goat accommodation', 'is_active' => 1, 'help_pre' => "Where does your goat sleep", 'help_post' => "thank you for your time", @@ -55,10 +62,10 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase { 'is_reserved' => 1, ); - $price_set = $this->callAPISuccess('price_set', 'create', $priceSetparams); + $price_set = $this->callAPISuccess('price_set', 'create', $priceSetParams); $this->priceSetID = $price_set['id']; - $priceFieldparams = array( + $priceFieldParams = array( 'price_set_id' => $this->priceSetID, 'name' => 'grassvariety', 'label' => 'Grass Variety', @@ -66,18 +73,18 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase { 'is_enter_qty' => 1, 'is_active' => 1, ); - $priceField = $this->callAPISuccess('price_field', 'create', $priceFieldparams); + $priceField = $this->callAPISuccess('price_field', 'create', $priceFieldParams); $this->priceFieldID = $priceField['id']; $this->_params = array( 'price_field_id' => $this->priceFieldID, - 'name' => 'ryegrass', + 'name' => 'rye grass', 'label' => 'juicy and healthy', 'amount' => 1, ); $membershipOrgId = $this->organizationCreate(NULL); $this->_membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $membershipOrgId)); - $priceSetparams1 = array( + $priceSetParams1 = array( 'name' => 'priceset', 'title' => 'Priceset with Multiple Terms', 'is_active' => 1, @@ -86,9 +93,9 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase { 'is_quick_config' => 1, 'is_reserved' => 1, ); - $price_set1 = $this->callAPISuccess('price_set', 'create', $priceSetparams1); + $price_set1 = $this->callAPISuccess('price_set', 'create', $priceSetParams1); $this->priceSetID1 = $price_set1['id']; - $priceFieldparams1 = array( + $priceFieldParams1 = array( 'price_set_id' => $this->priceSetID1, 'name' => 'memtype', 'label' => 'memtype', @@ -96,10 +103,15 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase { 'is_enter_qty' => 1, 'is_active' => 1, ); - $priceField1 = $this->callAPISuccess('price_field', 'create', $priceFieldparams1); + $priceField1 = $this->callAPISuccess('price_field', 'create', $priceFieldParams1); $this->priceFieldID1 = $priceField1['id']; } + /** + * Tear down function. + * + * @throws \Exception + */ public function tearDown() { $tablesToTruncate = array( 'civicrm_contact', -- 2.25.1