-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[6.x] Re-do the
UpdateClassReferences
update script (#985)
* Re-do the UpdateClassReferences update script * wip * Fix styling --------- Co-authored-by: duncanmcclean <[email protected]>
- Loading branch information
1 parent
f267354
commit 355e424
Showing
4 changed files
with
89 additions
and
22 deletions.
There are no files selected for viewing
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
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
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
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,38 @@ | ||
<?php | ||
|
||
use DoubleThreeDigital\SimpleCommerce\UpdateScripts\v6_0\UpdateClassReferences; | ||
use Statamic\Facades\Entry; | ||
|
||
it('updates reference to gateway class', function () { | ||
$orderEntry = Entry::make() | ||
->collection('orders') | ||
->id('test') | ||
->data(['gateway' => ['use' => 'DoubleThreeDigital\SimpleCommerce\Gateways\Builtin\StripeGateway', 'data' => ['id' => 'pi_1234']]]); | ||
|
||
$orderEntry->save(); | ||
|
||
(new UpdateClassReferences('doublethreedigital/simple-commerce', '6.0.0'))->update(); | ||
|
||
$orderEntry->fresh(); | ||
|
||
expect($orderEntry->get('gateway'))->toBe([ | ||
'use' => 'stripe', | ||
'data' => ['id' => 'pi_1234'], | ||
'refund' => null, | ||
]); | ||
}); | ||
|
||
it('updates reference to shipping method class', function () { | ||
$orderEntry = Entry::make() | ||
->collection('orders') | ||
->id('test') | ||
->data(['shipping_method' => 'DoubleThreeDigital\SimpleCommerce\Shipping\FreeShipping']); | ||
|
||
$orderEntry->save(); | ||
|
||
(new UpdateClassReferences('doublethreedigital/simple-commerce', '6.0.0'))->update(); | ||
|
||
$orderEntry->fresh(); | ||
|
||
expect($orderEntry->get('shipping_method'))->toBe('free_shipping'); | ||
}); |