Skip to content

Commit

Permalink
feature: add tests for canHandle method
Browse files Browse the repository at this point in the history
  • Loading branch information
glaubersilva committed Jul 11, 2024
1 parent 251a5e4 commit d66bd27
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions tests/Feature/FormMigration/Steps/TestRazorpayPerFormSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,38 @@
*/
class TestRazorpayPerFormSettings extends TestCase
{

use RefreshDatabase, LegacyDonationFormAdapter;

/**
* @unreleased
*/
public function testCanHandleShouldReturnFalse()
{
$meta = [
'razorpay_per_form_account_options' => 'global',
];
$formV2 = $this->createSimpleDonationForm(['meta' => $meta]);
$payload = FormMigrationPayload::fromFormV2($formV2);
$razorpayPerFormSettings = new RazorpayPerFormSettings($payload);

$this->assertNotTrue($razorpayPerFormSettings->canHandle());
}

/**
* @unreleased
*/
public function testCanHandleShouldReturnTrue()
{
$meta = [
'razorpay_per_form_account_options' => 'enabled',
];
$formV2 = $this->createSimpleDonationForm(['meta' => $meta]);
$payload = FormMigrationPayload::fromFormV2($formV2);
$razorpayPerFormSettings = new RazorpayPerFormSettings($payload);

$this->assertTrue($razorpayPerFormSettings->canHandle());
}

/**
* @unreleased
*/
Expand Down Expand Up @@ -49,6 +78,5 @@ public function testProcessShouldUpdatePaymentGatewaysBlockAttributes(): void
$this->assertSame($testKeyId, $paymentGatewaysBlock->getAttribute('razorpayTestKeyId'));
$this->assertSame($testSecretKey, $paymentGatewaysBlock->getAttribute('razorpayTestSecretKey'));
}

}

0 comments on commit d66bd27

Please sign in to comment.