Skip to content

Commit 8a8bd42

Browse files
committed
Add tests
1 parent c339a39 commit 8a8bd42

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

tests/QueuedEmailsTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ public function queueing_an_email_will_leave_sending_on_false()
2121
$this->assertEquals(0, $email->sending);
2222
}
2323

24+
/** @test */
25+
public function queueing_an_email_will_set_the_queued_at_column()
26+
{
27+
$email = $this->queueEmail();
28+
29+
$this->assertNotNull($email->queued_at);
30+
}
31+
2432
/** @test */
2533
public function queueing_an_email_will_dispatch_a_job()
2634
{

tests/SendEmailsCommandTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Carbon\Carbon;
66
use Illuminate\Support\Facades\DB;
7+
use Illuminate\Support\Facades\Queue;
78
use Stackkit\LaravelDatabaseEmails\Store;
89

910
class SendEmailsCommandTest extends TestCase
@@ -45,6 +46,18 @@ public function an_email_should_not_be_sent_once_it_is_marked_as_sent()
4546
$this->assertEquals($firstSend, $email->fresh()->getSendDate());
4647
}
4748

49+
/** @test */
50+
public function an_email_should_not_be_sent_if_it_is_queued()
51+
{
52+
Queue::fake();
53+
54+
$email = $this->queueEmail();
55+
56+
$this->artisan('email:send');
57+
58+
$this->assertNull($email->fresh()->getSendDate());
59+
}
60+
4861
/** @test */
4962
public function if_an_email_fails_to_be_sent_it_should_be_logged_in_the_database()
5063
{

0 commit comments

Comments
 (0)