File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ public function __construct(
105105
106106 /**
107107 * Handles asynchronous email sending
108+ *
108109 * @return void
109110 */
110111 public function sendEmails ()
@@ -137,6 +138,9 @@ public function sendEmails()
137138 'email_sent '
138139 );
139140 } else {
141+ // When the email is failed to send, the email_sent attribute
142+ // should be set to false, preventing this email from being
143+ // sent over and over again in the next cron runs.
140144 $ this ->entityResource ->saveAttribute (
141145 $ item ->setEmailSent (false ),
142146 'email_sent '
Original file line number Diff line number Diff line change @@ -256,6 +256,12 @@ public function testExecute(
256256 ->expects ($ this ->once ())
257257 ->method ('saveAttribute ' )
258258 ->with ($ collectionItem );
259+ } else {
260+ $ collectionItem
261+ ->expects ($ this ->once ())
262+ ->method ('setEmailSent ' )
263+ ->with (false )
264+ ->willReturn ($ collectionItem );
259265 }
260266 }
261267 }
You can’t perform that action at this time.
0 commit comments