This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from MarkVaughn/mark/mailable
Allow mailer to intercept Mailable objects
- Loading branch information
Showing
4 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,4 +190,20 @@ public function test_global_from() | |
$this->seeMessageFrom('[email protected]'); | ||
$this->seeMessageFrom('[email protected]', 'Example Person'); | ||
} | ||
|
||
public function test_with_mailables() | ||
{ | ||
$mailer = $this->mailer = $this->getMailThief(); | ||
|
||
$mailable = new TestMailable(); | ||
$mailable->to('[email protected]') | ||
->from('[email protected]', 'Example Person') | ||
->subject('Message for you'); | ||
|
||
$mailer->send($mailable); | ||
|
||
$this->seeMessageFrom('[email protected]'); | ||
$this->seeMessageFrom('[email protected]', 'Example Person'); | ||
$this->seeInSubjects('Message for you'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -450,4 +450,13 @@ public function test_it_gets_subjects() | |
|
||
$this->assertEquals($messages, $mailer->subjects()->all()); | ||
} | ||
|
||
public function test_it_sends_mailables() | ||
{ | ||
$mailer = $this->getMailThief(); | ||
$mailable = new TestMailable(); | ||
$mailable->to('[email protected]'); | ||
$mailer->send($mailable); | ||
$this->assertTrue($mailer->hasMessageFor('[email protected]')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
use Illuminate\Mail\Mailable; | ||
|
||
class TestMailable extends Mailable | ||
{ | ||
public function build() | ||
{ | ||
return $this->view('example-view'); | ||
} | ||
} |