* @throws \CRM_Core_Exception
*/
public function tearDown(): void {
- $this->deleteTestObjects();
+ $this->quickCleanUpFinancialEntities();
MembershipType::delete()->addWhere('name', 'NOT IN', ['General', 'Student', 'Lifetime'])->execute();
$this->quickCleanup([
'civicrm_action_schedule',
'civicrm_action_log',
- 'civicrm_membership',
- 'civicrm_line_item',
- 'civicrm_participant',
- 'civicrm_event',
'civicrm_email',
], TRUE);
- $this->quickCleanUpFinancialEntities();
parent::tearDown();
}
'registration_start_date' => date('Ymd', strtotime('-5 day')),
'registration_end_date' => date('Ymd', strtotime('+7 day')),
];
- $event = $this->eventCreate($params);
- $this->participantCreate(['contact_id' => $contact, 'event_id' => $event['id']]);
+ $event = $this->eventCreateUnpaid($params);
+ $this->participantCreate(['contact_id' => $contact, 'event_id' => $this->getEventID()]);
//Create a scheduled reminder to send email 7 days before registration date.
$actionSchedule = $this->fixtures['sched_event_type_start_1week_before'];
//Create an event with registration end date = 2 week from now.
$params['end_date'] = date('Ymd', strtotime('+2 week'));
$params['registration_end_date'] = date('Ymd', strtotime('+2 week'));
- $event2 = $this->eventCreate($params);
- $this->participantCreate(['contact_id' => $contact2, 'event_id' => $event2['id']]);
+ $this->participantCreate(['contact_id' => $contact2, 'event_id' => $this->eventCreateUnpaid($params, 'event_2')['id']]);
//Assert there is no reminder sent to the contact.
$this->assertCronRuns([
*/
class CRM_Core_BAO_FinancialTrxnTest extends CiviUnitTestCase {
+ public function tearDown(): void {
+ $this->quickCleanUpFinancialEntities();
+ parent::tearDown();
+ }
+
/**
* Check method create().
*
*/
class CRM_Core_BAO_RecurringEntityTest extends CiviUnitTestCase {
+ public function tearDown(): void {
+ $this->quickCleanUpFinancialEntities();
+ parent::tearDown();
+ }
+
/**
* Testing Activity Generation through Entity Recursion.
*/
"start_action_date" => date("YmdHis"),
"repetition_frequency_unit" => "week",
"repetition_frequency_interval" => "3",
- "start_action_condition" => "monday,tuesday,wednesday,thursday,friday,saturday",
- "start_action_offset" => "2",
+ "start_action_condition" => 'monday,tuesday,wednesday,thursday,friday,saturday',
+ 'start_action_offset' => 2,
];
- $actionScheduleObj = CRM_Core_BAO_ActionSchedule::writeRecord($params);
- return $actionScheduleObj;
+ return CRM_Core_BAO_ActionSchedule::writeRecord($params);
}
/**
/**
* Testing Event Generation through Entity Recursion.
*/
- public function testRepeatEventCreation() {
- $event = $this->eventCreate();
- $entity_table = "civicrm_event";
+ public function testRepeatEventCreation(): void {
+ $event = $this->eventCreatePaid();
+ $entity_table = 'civicrm_event';
$entity_id = $event["id"];
- CRM_Price_BAO_PriceSet::addTo($entity_table, $entity_id, 1);
$actionScheduleObj = $this->createActionSchedule($entity_id, $entity_table);
$recurringEntities = $this->createRecurringEntities($actionScheduleObj, $entity_id, $entity_table);
$finalResult = CRM_Core_BAO_RecurringEntity::updateModeAndPriceSet($entity_id, $entity_table, CRM_Core_BAO_RecurringEntity::MODE_ALL_ENTITY_IN_SERIES, [], 2);
$priceSetOne = CRM_Price_BAO_PriceSet::getFor($entity_table, $recurringEntities["civicrm_price_set_entity"][0]);
$priceSetTwo = CRM_Price_BAO_PriceSet::getFor($entity_table, $recurringEntities["civicrm_price_set_entity"][1]);
$this->assertEquals(2, $priceSetOne, "Price set id of the recurring event is not updated.");
- $this->assertEquals(2, $priceSetTwo, "Price set id of the recurring event is not updated.");
+ $this->assertEquals(2, $priceSetTwo, 'Price set id of the recurring event is not updated.');
}
/**
use Civi\Api4\Event;
use Civi\Api4\Email;
+use Civi\Api4\Generic\Result;
/**
* Test CRM_Event_Form_Registration functions.
*/
class CRM_Event_Form_ManageEvent_LocationTest extends CiviUnitTestCase {
+ public function tearDown(): void {
+ $this->quickCleanUpFinancialEntities();
+ parent::tearDown();
+ }
+
/**
* Test the right emails exist after submitting the location form twice.
*
* @throws \CRM_Core_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
- public function testSubmit() {
- $eventID = (int) $this->eventCreate()['id'];
+ public function testSubmit(): void {
+ $eventID = (int) $this->eventCreateUnpaid()['id'];
$this->submitForm([], $eventID);
$this->assertCorrectEmails($eventID);
* Create() method
* create various elements of location block
* with civicrm_loc_block
+ *
+ * @throws \CRM_Core_Exception
*/
- public function testCreateWithLocBlock() {
- $eventID = (int) $this->eventCreate()['id'];
+ public function testCreateWithLocBlock(): void {
+ $eventID = (int) $this->eventCreateUnpaid()['id'];
$this->submitForm([
'address' => [
'1' => [
* @throws \CRM_Core_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
- public function testUpdateLocationBlock() {
- $eventID = (int) $this->eventCreate()['id'];
+ public function testUpdateLocationBlock(): void {
+ $eventID = (int) $this->eventCreateUnpaid()['id'];
$this->submitForm([
'address' => [
'1' => [
*
* @return array
*/
- protected function getFormValues() {
+ protected function getFormValues(): array {
return [
'address' =>
[
*
* @return \Civi\Api4\Generic\Result
* @throws \CRM_Core_Exception
- * @throws \Civi\API\Exception\UnauthorizedException
*/
- protected function assertCorrectEmails($eventID) {
+ protected function assertCorrectEmails(int $eventID): Result {
$emails = Email::get()
->addWhere('email', 'IN', ['bigger_party@example.org', 'celebration@example.org'])
->addOrderBy('email', 'DESC')