Skip to content

Commit 935433a

Browse files
committed
ACQE-8206: [Issue] [Checkout] Depend directives updated in failed payment email template
- Modified test file according given review changes
1 parent 0106d95 commit 935433a

File tree

1 file changed

+10
-13
lines changed
  • dev/tests/integration/testsuite/Magento/Checkout/Helper

1 file changed

+10
-13
lines changed

dev/tests/integration/testsuite/Magento/Checkout/Helper/DataTest.php

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Magento\Checkout\Helper\Data;
1212
use Magento\Framework\ObjectManagerInterface;
1313
use Magento\Quote\Model\Quote;
14-
use Magento\Quote\Model\QuoteFactory;
1514
use Magento\Quote\Model\QuoteManagement;
1615
use Magento\Sales\Api\OrderRepositoryInterface;
1716
use Magento\Sales\Model\Order;
@@ -25,8 +24,8 @@
2524
* Ensures that when a virtual product order fails during payment, the appropriate failure email is
2625
* sent and does not include any shipping address or method information.
2726
*
28-
* @magentoAppIsolation enabled
2927
* @magentoDbIsolation enabled
28+
* @magentoAppIsolation enabled
3029
* @magentoDataFixture Magento/Checkout/_files/quote_with_virtual_product_and_address.php
3130
*
3231
* @AllureSuite("Checkout")
@@ -44,11 +43,6 @@ class DataTest extends TestCase
4443
*/
4544
private QuoteManagement $quoteManagement;
4645

47-
/**
48-
* @var QuoteFactory
49-
*/
50-
private QuoteFactory $quoteFactory;
51-
5246
/**
5347
* @var Data
5448
*/
@@ -85,7 +79,6 @@ protected function setUp(): void
8579

8680
$this->objectManager = Bootstrap::getObjectManager();
8781
$this->quoteManagement = $this->objectManager->get(QuoteManagement::class);
88-
$this->quoteFactory = $this->objectManager->get(QuoteFactory::class);
8982
$this->checkoutHelper = $this->objectManager->get(Data::class);
9083
$this->orderRepository = $this->objectManager->get(OrderRepositoryInterface::class);
9184
$this->transportBuilder = $this->objectManager->get(TransportBuilderMock::class);
@@ -103,14 +96,13 @@ protected function setUp(): void
10396
*/
10497
public function testSendPaymentFailedEmail(): void
10598
{
106-
[$order, $quote] = $this->prepareOrderFromFixtureQuote();
99+
[$order, $quote] = $this->createOrderFromFixture();
107100
$this->simulatePaymentFailure($order);
108101

109102
$this->checkoutHelper->sendPaymentFailedEmail(
110103
$quote,
111-
(string)__('Simulated payment failure'),
112-
$quote->getPayment()->getMethod(),
113-
$quote->getCheckoutMethod()
104+
'Simulated payment failure',
105+
$quote->getPayment()->getMethod()
114106
);
115107

116108
$message = $this->transportBuilder->getSentMessage();
@@ -135,6 +127,11 @@ public function testSendPaymentFailedEmail(): void
135127
$emailContent,
136128
'Shipping method should not appear in the payment failed email for virtual product.'
137129
);
130+
$this->assertStringContainsString(
131+
'Simulated payment failure',
132+
$emailContent,
133+
'Expected payment failure message to be present in the email.'
134+
);
138135
}
139136

140137
/**
@@ -145,7 +142,7 @@ public function testSendPaymentFailedEmail(): void
145142
*
146143
* @return array{0: Order, 1: Quote} Returns the created order and the original quote.
147144
*/
148-
private function prepareOrderFromFixtureQuote(): array
145+
private function createOrderFromFixture(): array
149146
{
150147
/** @var Quote $quote */
151148
$quote = $this->objectManager->create(Quote::class)

0 commit comments

Comments
 (0)