@@ -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