Skip to content

Commit 4fff14d

Browse files
ACQE-8959: Create Order from Admin with Async Notification
- Updated guest user to customer to place order
1 parent fdff244 commit 4fff14d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/AdminOrderAsyncEmailTest.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
use Magento\Checkout\Test\Fixture\PlaceOrder as PlaceOrderFixture;
1212
use Magento\Checkout\Test\Fixture\SetBillingAddress as SetBillingAddressFixture;
1313
use Magento\Checkout\Test\Fixture\SetDeliveryMethod as SetDeliveryMethodFixture;
14-
use Magento\Checkout\Test\Fixture\SetGuestEmail as SetGuestEmailFixture;
1514
use Magento\Checkout\Test\Fixture\SetPaymentMethod as SetPaymentMethodFixture;
1615
use Magento\Checkout\Test\Fixture\SetShippingAddress as SetShippingAddressFixture;
16+
use Magento\Customer\Test\Fixture\Customer as CustomerFixture;
1717
use Magento\Framework\App\Area;
1818
use Magento\Framework\Exception\LocalizedException;
1919
use Magento\Framework\Mail\EmailMessageInterface;
2020
use Magento\Quote\Test\Fixture\AddProductToCart as AddProductToCartFixture;
21-
use Magento\Quote\Test\Fixture\GuestCart as GuestCartFixture;
21+
use Magento\Quote\Test\Fixture\CustomerCart as CustomerCartFixture;
2222
use Magento\TestFramework\Fixture\Config;
2323
use Magento\TestFramework\Fixture\DataFixture;
2424
use Magento\TestFramework\Fixture\DataFixtureStorageManager;
@@ -32,6 +32,11 @@
3232
*/
3333
class AdminOrderAsyncEmailTest extends TestCase
3434
{
35+
/**
36+
* Customer email address for async order notification testing
37+
*/
38+
private const CUSTOMER_EMAIL = 'async-customer@example.com';
39+
3540
/**
3641
* @var TransportBuilderMock
3742
*/
@@ -57,6 +62,7 @@ function (EmailMessageInterface $message): void {
5762

5863
/**
5964
* Verifies that an order email is dispatched only after the async cron job runs.
65+
* Uses a registered customer with accessible email as per test preconditions.
6066
*
6167
* @return void
6268
* @throws LocalizedException
@@ -67,12 +73,12 @@ function (EmailMessageInterface $message): void {
6773
Config('sales_email/general/async_sending', '1'),
6874
Config('sales_email/order/enabled', '1'),
6975
Config('sales_email/general/sending_limit', '10'),
76+
DataFixture(CustomerFixture::class, ['email' => 'async-customer@example.com'], as: 'customer'),
7077
DataFixture(ProductFixture::class, as: 'product'),
71-
DataFixture(GuestCartFixture::class, as: 'cart'),
78+
DataFixture(CustomerCartFixture::class, ['customer_id' => '$customer.id$'], as: 'cart'),
7279
DataFixture(AddProductToCartFixture::class, ['cart_id' => '$cart.id$', 'product_id' => '$product.id$']),
7380
DataFixture(SetBillingAddressFixture::class, ['cart_id' => '$cart.id$']),
7481
DataFixture(SetShippingAddressFixture::class, ['cart_id' => '$cart.id$']),
75-
DataFixture(SetGuestEmailFixture::class, ['cart_id' => '$cart.id$', 'email' => 'async-customer@example.com']),
7682
DataFixture(SetDeliveryMethodFixture::class, ['cart_id' => '$cart.id$']),
7783
DataFixture(SetPaymentMethodFixture::class, ['cart_id' => '$cart.id$', 'method' => 'checkmo']),
7884
DataFixture(PlaceOrderFixture::class, ['cart_id' => '$cart.id$'], 'order'),
@@ -124,7 +130,7 @@ public function testAsynchronousOrderEmailDispatchedByCron(): void
124130
'Order confirmation subject should contain the word "Order".'
125131
);
126132
$this->assertEquals(
127-
'async-customer@example.com',
133+
self::CUSTOMER_EMAIL,
128134
$email->getTo()[0]->getEmail(),
129135
'Email should be addressed to the customer used during checkout.'
130136
);

0 commit comments

Comments
 (0)