Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6953ab2

Browse files
committedMar 18, 2018
Merge branch 'development'
2 parents d244293 + a63ecec commit 6953ab2

4 files changed

+42
-2
lines changed
 

‎src/LaravelDatabaseEmailsServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function register()
3434
$this->commands([
3535
SendEmailsCommand::class,
3636
RetryFailedEmailsCommand::class,
37+
ResendEmailsCommand::class,
3738
]);
3839
}
3940
}

‎src/ResendEmailsCommand.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Buildcode\LaravelDatabaseEmails;
4+
5+
class ResendEmailsCommand extends RetryFailedEmailsCommand
6+
{
7+
/**
8+
* The name and signature of the console command.
9+
*
10+
* @var string
11+
*/
12+
protected $signature = 'email:resend {id?}';
13+
14+
/**
15+
* The console command description.
16+
*
17+
* @var string
18+
*/
19+
protected $description = 'Resend failed e-mails';
20+
}

‎src/RetryFailedEmailsCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ public function __construct(Store $store)
4646
*/
4747
public function handle()
4848
{
49+
if (get_class($this) === RetryFailedEmailsCommand::class) {
50+
$this->warn('This command is deprecated, please use email:resend instead');
51+
}
52+
4953
$emails = $this->store->getFailed(
5054
$this->argument('id')
5155
);

‎tests/RetryFailedEmailsCommandTest.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Tests;
44

5+
use Illuminate\Support\Facades\Artisan;
56
use Illuminate\Support\Facades\DB;
67

78
class RetryFailedEmailsCommandTest extends TestCase
@@ -31,7 +32,7 @@ function an_email_cannot_be_reset_if_the_max_attempt_count_has_not_been_reached(
3132
// try 2 more times, reaching 3 attempts and thus failing and able to retry
3233
$this->artisan('email:send');
3334
$this->artisan('email:send');
34-
$this->artisan('email:retry');
35+
$this->artisan('email:resend');
3536

3637
$this->assertEquals(2, DB::table('emails')->count());
3738
}
@@ -45,8 +46,22 @@ function a_single_email_can_be_resent()
4546
// simulate emailB being failed...
4647
$emailB->update(['failed' => 1, 'attempts' => 3]);
4748

48-
$this->artisan('email:retry', ['id' => 2]);
49+
$this->artisan('email:resend', ['id' => 2]);
4950

5051
$this->assertEquals(3, DB::table('emails')->count());
5152
}
53+
54+
/** @test */
55+
function email_retry_is_deprecated()
56+
{
57+
$deprecated = 'This command is deprecated';
58+
59+
$this->artisan('email:retry');
60+
61+
$this->assertContains($deprecated, Artisan::output());
62+
63+
$this->artisan('email:resend');
64+
65+
$this->assertNotContains($deprecated, Artisan::output());
66+
}
5267
}

0 commit comments

Comments
 (0)
Please sign in to comment.