Skip to content

Commit 2398f25

Browse files
ACQE-8868: Create Credit Memo for Offline Payment Methods with Async Email Notification
- Fixed Logical issue of creditmemo assertion
1 parent e128e6a commit 2398f25

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ protected function setUp(): void
7474
// Capture sent emails
7575
$this->transportBuilder->setOnMessageSentCallback(
7676
function (EmailMessageInterface $message) {
77+
var_dump('sandesh');
7778
$this->sentEmails[] = $message;
7879
}
7980
);
@@ -111,6 +112,8 @@ public function testCreateCreditmemoWithAsyncEmailNotification(): void
111112
$creditmemo = $this->creditmemoFactory->createByOrder($order);
112113
$creditmemoRepository = Bootstrap::getObjectManager()->get(CreditmemoRepositoryInterface::class);
113114
$creditmemoRepository->save($creditmemo);
115+
$creditmemo->setSendEmail(true);
116+
$creditmemoRepository->save($creditmemo);
114117
$this->assertCount(
115118
0,
116119
$this->sentEmails,
@@ -120,9 +123,8 @@ public function testCreateCreditmemoWithAsyncEmailNotification(): void
120123
$creditmemo->getEmailSent(),
121124
'EmailSent should be empty until async process sends it'
122125
);
123-
$result = $this->creditmemoSender->send($creditmemo, true);
124-
$this->assertTrue($result, 'Email should be sent after async processing');
125-
$this->assertNotEmpty($creditmemo->getEmailSent(), 'EmailSent flag should be set');
126+
$creditmemoEmailCron = Bootstrap::getObjectManager()->get('SalesCreditmemoSendEmailsCron');
127+
$creditmemoEmailCron->execute();
126128
$this->assertCount(1, $this->sentEmails, 'One refund email should be sent');
127129
$email = $this->sentEmails[0];
128130
$this->assertInstanceOf(EmailMessageInterface::class, $email);

0 commit comments

Comments
 (0)