-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ante Laca
committed
Mar 25, 2024
1 parent
8f15af6
commit 6ea2c6c
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
tests/Feature/FormMigration/Steps/TestDoubleTheDonation.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace Give\Tests\Feature\FormMigration\Steps; | ||
|
||
use Give\FormMigration\DataTransferObjects\FormMigrationPayload; | ||
use Give\FormMigration\Steps\DoubleTheDonation; | ||
use Give\Tests\TestCase; | ||
use Give\Tests\TestTraits\RefreshDatabase; | ||
use Give\Tests\Unit\DonationForms\TestTraits\LegacyDonationFormAdapter; | ||
|
||
/** | ||
* @unreleased | ||
* | ||
* @covers \Give\FormMigration\Steps\DoubleTheDonation | ||
*/ | ||
class TestDoubleTheDonation extends TestCase | ||
{ | ||
use RefreshDatabase, LegacyDonationFormAdapter; | ||
|
||
public function testProcessShouldUpdateDoubleTheDonationBlockAttributes(): void | ||
{ | ||
$meta = [ | ||
'give_dtd_label' => 'DTD Label', | ||
]; | ||
|
||
$company = [ | ||
'company_id' => '', | ||
'company_name' => '', | ||
'entered_text' => '', | ||
]; | ||
|
||
$formV2 = $this->createSimpleDonationForm(['meta' => $meta]); | ||
$payload = FormMigrationPayload::fromFormV2($formV2); | ||
|
||
$dtd = new DoubleTheDonation($payload); | ||
$dtd->process(); | ||
|
||
$block = $payload->formV3->blocks->findByName('givewp/dtd'); | ||
|
||
$this->assertSame($meta['give_dtd_label'], $block->getAttribute('label')); | ||
$this->assertEqualsIgnoringCase($company, $block->getAttribute('company')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters