diff --git a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php index a9cbb3718444..1a06b3df1ff7 100644 --- a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php @@ -685,7 +685,7 @@ public function testAssignProportionalLineItems() { /** * Add participant with contribution * - * @return array + * @return CRM_Contribute_BAO_Contribution * * @throws \CRM_Core_Exception * @throws \CiviCRM_API3_Exception @@ -695,7 +695,7 @@ public function addParticipantWithContribution() { $this->_contactId = $this->individualCreate(); $event = $this->eventCreatePaid([]); $this->_eventId = $event['id']; - $priceSetId = $this->priceSetID; + $priceSetID = $this->ids['PriceSet']['event']; $paramsField = [ 'label' => 'Price Field', 'name' => CRM_Utils_String::titleToVar('Price Field'), @@ -709,7 +709,7 @@ public function addParticipantWithContribution() { 'weight' => 1, 'options_per_line' => 1, 'is_active' => ['1' => 1, '2' => 1], - 'price_set_id' => $this->priceSetID, + 'price_set_id' => $priceSetID, 'is_enter_qty' => 1, 'financial_type_id' => CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', 'Event Fee', 'id', 'name'), ]; @@ -720,7 +720,7 @@ public function addParticipantWithContribution() { 'is_monetary' => 1, ]; CRM_Event_BAO_Event::create($eventParams); - CRM_Price_BAO_PriceSet::addTo('civicrm_event', $this->_eventId, $priceSetId); + CRM_Price_BAO_PriceSet::addTo('civicrm_event', $this->_eventId, $priceSetID); $priceFields = $this->callAPISuccess('PriceFieldValue', 'get', ['price_field_id' => $priceField->id]); $participantParams = [ diff --git a/tests/phpunit/CRM/Event/Form/ParticipantTest.php b/tests/phpunit/CRM/Event/Form/ParticipantTest.php index d96c4e9ff5d3..cdb0ae133c67 100644 --- a/tests/phpunit/CRM/Event/Form/ParticipantTest.php +++ b/tests/phpunit/CRM/Event/Form/ParticipantTest.php @@ -859,7 +859,7 @@ public function testTransferParticipantRegistration() { * @return int */ protected function getEventID(): int { - return $this->ids['event']['event']; + return $this->ids['Event']['event']; } /** diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index a200260d53d2..d9d795b84ddc 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -1054,12 +1054,13 @@ public function eventCreate($params = []) { * @throws \CRM_Core_Exception */ protected function eventCreatePaid($params, $options = [['name' => 'hundy', 'amount' => 100]], $key = 'event') { + $params['is_monetary'] = TRUE; $event = $this->eventCreate($params); - $this->ids['event'][$key] = (int) $event['id']; - $this->priceSetID = $this->ids['PriceSet'][] = $this->eventPriceSetCreate(55, 0, 'Radio', $options); - CRM_Price_BAO_PriceSet::addTo('civicrm_event', $event['id'], $this->priceSetID); - $priceSet = CRM_Price_BAO_PriceSet::getSetDetail($this->priceSetID, TRUE, FALSE); - $priceSet = $priceSet[$this->priceSetID] ?? NULL; + $this->ids['Event'][$key] = (int) $event['id']; + $this->ids['PriceSet'][$key] = $this->eventPriceSetCreate(55, 0, 'Radio', $options); + CRM_Price_BAO_PriceSet::addTo('civicrm_event', $event['id'], $this->ids['PriceSet'][$key]); + $priceSet = CRM_Price_BAO_PriceSet::getSetDetail($this->ids['PriceSet'][$key], TRUE, FALSE); + $priceSet = $priceSet[$this->ids['PriceSet'][$key]] ?? NULL; $this->eventFeeBlock = $priceSet['fields'] ?? NULL; return $event; }