forked from drupalcommerce/commerce
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #2808813: New user account should own previous guest checkout o…
…rder(s).
- Loading branch information
1 parent
9276e9a
commit 8565b2f
Showing
2 changed files
with
70 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Drupal\Tests\commerce_order\Functional; | ||
|
||
use Drupal\commerce_order\Entity\Order; | ||
|
||
/** | ||
* Tests the order account (owner) functionality. | ||
* | ||
* @group commerce | ||
*/ | ||
class OrderAccountTest extends OrderBrowserTestBase { | ||
|
||
/** | ||
* Tests assigning guest orders to newly created users (after checkout). | ||
*/ | ||
public function testNewAccountOwnsOrderAfterGuestCheckout() { | ||
$order_item = $this->createEntity('commerce_order_item', [ | ||
'type' => 'product_variation', | ||
]); | ||
$order = $this->createEntity('commerce_order', [ | ||
'type' => 'default', | ||
'uid' => 0, | ||
'mail' => '[email protected]', | ||
'order_items' => [$order_item], | ||
]); | ||
$this->assertEmpty($order->getOwnerId(), 'The guest order has no owner account.'); | ||
$user = $this->createUser([], 'guest'); | ||
$order = Order::load($order->id()); | ||
$this->assertEquals($user->id(), $order->getOwnerId(), 'New user account owns previous guest order.'); | ||
} | ||
|
||
} |