Skip to content

Commit

Permalink
MAE-318: Fix failing tests because of the renamed files
Browse files Browse the repository at this point in the history
  • Loading branch information
ahed-compucorp committed Feb 15, 2021
1 parent 7ee7930 commit 8824a1e
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 88 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<?php

use CRM_MembershipExtras_Queue_TestCase as QueueTestCase;
use CRM_MembershipExtras_Test_Entity_PaymentPlanMembershipOrder as PaymentPlanMembershipOrder;
use CRM_MembershipExtras_Test_Fabricator_MembershipType as MembershipTypeFabricator;
use CRM_MembershipExtras_Test_Fabricator_PaymentPlanOrder as PaymentPlanOrderFabricator;
use CRM_MembershipExtras_Test_Fabricator_AutoMembershipUpgradeRule as AutoMembershipUpgradeRuleFabricator;
use CRM_MembershipExtras_Job_OfflineAutoRenewal_MultipleInstalmentPlan as MultipleInstalmentRenewalJob;
use CRM_MembershipExtras_Queue_Builder_OfflineMultipleInstalmentPlans as OfflineMultipleInstalmentPlansQueueBuilder;
use CRM_MembershipExtras_Test_Fabricator_LineItem as LineItemFabricator;
use CRM_MembershipExtras_Test_Fabricator_RecurringLineItem as RecurringLineItemFabricator;

/**
* Class CRM_MembershipExtras_Job_OfflineAutoRenewal_MultiInstalmentPlanTest
* Class CRM_MembershipExtras_Queue_Task_RenewMultipleInstalmentPlanTest
*
* @group headless
*/
class CRM_MembershipExtras_Job_OfflineAutoRenewal_MultiInstalmentPlanTest extends BaseHeadlessTest {
class CRM_MembershipExtras_Queue_Task_RenewMultipleInstalmentPlanTest extends QueueTestCase {

/**
* A rolling membership type that we
Expand All @@ -32,6 +33,7 @@ class CRM_MembershipExtras_Job_OfflineAutoRenewal_MultiInstalmentPlanTest extend
private $testRollingMembershipTypePriceFieldValue;

public function setUp() {
parent::setUp();
$this->setDefaultPaymentPlanSettings();
$this->createTestRollingMembershipType();
}
Expand Down Expand Up @@ -81,8 +83,8 @@ public function testRenewalWithMembershipEndDateLessThanTodayDateWillRenew() {
];
$paymentPlan = PaymentPlanOrderFabricator::fabricate($paymentPlanMembershipOrder);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$this->assertTrue($this->isPaymentPlanMembershipRenewed($paymentPlan['id'], '+1 year -1 month -1 day'));
}
Expand All @@ -105,8 +107,8 @@ public function testRenewalWithMembershipEndDateEqualTodayDateWillRenew() {
];
$paymentPlan = PaymentPlanOrderFabricator::fabricate($paymentPlanMembershipOrder);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$this->assertTrue($this->isPaymentPlanMembershipRenewed($paymentPlan['id'], '+1 year'));
}
Expand All @@ -129,8 +131,8 @@ public function testRenewalWithMembershipEndDateLargerThanTodayDateWillNotRenew(
];
$paymentPlan = PaymentPlanOrderFabricator::fabricate($paymentPlanMembershipOrder);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$this->assertFalse($this->isPaymentPlanMembershipRenewed($paymentPlan['id'], '+1 year +1 day'));
}
Expand Down Expand Up @@ -161,8 +163,8 @@ public function testRenewalWithNonOfflinePaymentProcessorPaymentPlanWillNotRenew
];
$paymentPlan = PaymentPlanOrderFabricator::fabricate($paymentPlanMembershipOrder);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$this->assertFalse($this->isPaymentPlanMembershipRenewed($paymentPlan['id'], '+1 year -1 month -1 day'));
}
Expand All @@ -185,8 +187,8 @@ public function testRenewalWithNonCompletedInstalmentWillRenew() {
];
$paymentPlan = PaymentPlanOrderFabricator::fabricate($paymentPlanMembershipOrder);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$this->assertTrue($this->isPaymentPlanMembershipRenewed($paymentPlan['id'], '+1 year -1 month -1 day'));
}
Expand All @@ -209,8 +211,8 @@ public function testRenewalWithCancelledPaymentPlanWillNotRenew() {
];
$paymentPlan = PaymentPlanOrderFabricator::fabricate($paymentPlanMembershipOrder);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$this->assertFalse($this->isPaymentPlanMembershipRenewed($paymentPlan['id'], '+1 year -1 month -1 day'));
}
Expand All @@ -237,8 +239,8 @@ public function testRenewalWithMembershipEndDateLargerThanDateToRenewInAdvanceWi
];
$paymentPlan = PaymentPlanOrderFabricator::fabricate($paymentPlanMembershipOrder);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$this->assertTrue($this->isPaymentPlanMembershipRenewed($paymentPlan['id'], '+1 year +1 day'));
}
Expand All @@ -265,8 +267,8 @@ public function testRenewalWithMembershipEndDateLessThanDateToRenewInAdvanceWill
];
$paymentPlan = PaymentPlanOrderFabricator::fabricate($paymentPlanMembershipOrder);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$this->assertFalse($this->isPaymentPlanMembershipRenewed($paymentPlan['id'], '+1 year +14 day'));
}
Expand All @@ -293,8 +295,8 @@ public function testRenewalWithUpdateStartDateOnRenewalSettingOffWillNotUpdateMe
];
$paymentPlan = PaymentPlanOrderFabricator::fabricate($paymentPlanMembershipOrder);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$membership = civicrm_api3('Membership', 'get', [
'sequential' => 1,
Expand Down Expand Up @@ -325,8 +327,8 @@ public function testRenewalWithUpdateStartDateOnRenewalSettingOnWillUpdateMember
];
$paymentPlan = PaymentPlanOrderFabricator::fabricate($paymentPlanMembershipOrder);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$membership = civicrm_api3('Membership', 'get', [
'sequential' => 1,
Expand Down Expand Up @@ -354,8 +356,8 @@ public function testNewCopyOfLineItemsWillBeCreatedAfterRenewalInsteadOfReusingT
];
$paymentPlan = PaymentPlanOrderFabricator::fabricate($paymentPlanMembershipOrder);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$membershipId = (int) civicrm_api3('Membership', 'getvalue', [
'return' => 'id',
Expand Down Expand Up @@ -391,8 +393,8 @@ public function testRenewingMembershipWithEndDateLessThanTodayDateWillCreateCorr
];
$paymentPlan = PaymentPlanOrderFabricator::fabricate($paymentPlanMembershipOrder);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$currentPeriodSubscriptionLineItems = $this->getSubscriptionLineItems($paymentPlan['id']);
$nextPeriodId = $this->getTheNewRecurContributionIdFromCurrentOne($paymentPlan['id']);
Expand Down Expand Up @@ -460,8 +462,8 @@ public function testRenewingMembershipWillCreateCorrectMembershipPaymentRecords(
];
$paymentPlan = PaymentPlanOrderFabricator::fabricate($paymentPlanMembershipOrder);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$membershipId = (int) civicrm_api3('Membership', 'getvalue', [
'return' => 'id',
Expand Down Expand Up @@ -510,8 +512,8 @@ public function testRenewingUpgradableMembershipWithWillCreateUpgradedMembership
'period_length_unit' => CRM_MembershipExtras_SelectValues_AutoMembershipUpgradeRules_PeriodUnit::YEARS,
]);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$currentMembership = civicrm_api3('Membership', 'get', [
'sequential' => 1,
Expand Down Expand Up @@ -577,8 +579,8 @@ public function testRenewingUpgradableMembershipWillCreateCorrectMembershipPayme
'period_length_unit' => CRM_MembershipExtras_SelectValues_AutoMembershipUpgradeRules_PeriodUnit::YEARS,
]);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$nextPeriodId = $this->getTheNewRecurContributionIdFromCurrentOne($paymentPlan['id']);

Expand Down Expand Up @@ -661,8 +663,8 @@ public function testRenewingUpgradableMembershipWithWillCreateCorrectSubscriptio
'period_length_unit' => CRM_MembershipExtras_SelectValues_AutoMembershipUpgradeRules_PeriodUnit::YEARS,
]);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$currentPeriodSubscriptionLineItems = $this->getSubscriptionLineItems($paymentPlan['id']);
$nextPeriodId = $this->getTheNewRecurContributionIdFromCurrentOne($paymentPlan['id']);
Expand Down Expand Up @@ -798,8 +800,8 @@ public function testRenewalWithNonRenewableLineOnCurrentPeriodAndNewMembershipFo
'duration_unit' => 'year',
]);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$nextPeriodID = $this->getTheNewRecurContributionIdFromCurrentOne($paymentPlan['id']);
$this->assertPaymentPlanStructureIsOk($nextPeriodID, [
Expand Down Expand Up @@ -903,8 +905,8 @@ public function testRenewalWithMultipleLinesNotRenewingOnCurrentPeriodAndNewMemb
'duration_unit' => 'year',
]);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$nextPeriodID = $this->getTheNewRecurContributionIdFromCurrentOne($paymentPlan['id']);

Expand Down Expand Up @@ -997,8 +999,8 @@ public function testRenewalWithMultipleLinesSomeRenewingOnCurrentPeriodAndNewMem
'duration_unit' => 'year',
]);

$multipleInstalmentRenewal = new MultipleInstalmentRenewalJob();
$multipleInstalmentRenewal->run();
$this->runQueueBuilder(OfflineMultipleInstalmentPlansQueueBuilder::class);
$this->runQueueRunner();

$nextPeriodID = $this->getTheNewRecurContributionIdFromCurrentOne($paymentPlan['id']);

Expand Down
Loading

0 comments on commit 8824a1e

Please sign in to comment.