-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
124 additions
and
15 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
26 changes: 26 additions & 0 deletions
26
database/migrations/create_mailbox_inbound_emails_table.php.stub
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,26 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateMailboxInboundEmails extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('mailbox_inbound_emails', function (Blueprint $table) { | ||
$table->increments('id'); | ||
$table->nullableTimestamps(); | ||
}); | ||
} | ||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('mailbox_inbound_emails'); | ||
} | ||
} |
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
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
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,42 @@ | ||
<?php | ||
|
||
namespace BeyondCode\Mailbox\Tests\Drivers; | ||
|
||
use BeyondCode\Mailbox\Facades\Mailbox; | ||
use BeyondCode\Mailbox\InboundEmail; | ||
use BeyondCode\Mailbox\Tests\TestCase; | ||
use Illuminate\Mail\Mailable; | ||
use Illuminate\Support\Facades\Mail; | ||
|
||
class LogTest extends TestCase | ||
{ | ||
|
||
protected function getPackageProviders($app) | ||
{ | ||
$app['config']['mail.driver'] = 'log'; | ||
|
||
return parent::getPackageProviders($app); | ||
} | ||
|
||
/** @test */ | ||
public function it_catches_logged_mails() | ||
{ | ||
Mailbox::from('{name}@beyondco.de', function(InboundEmail $email, $name) { | ||
$this->assertSame($name, 'example'); | ||
$this->assertSame($email->from(), '[email protected]'); | ||
$this->assertSame($email->subject(), 'This is a subject'); | ||
}); | ||
|
||
Mail::to('[email protected]')->send(new TestMail); | ||
} | ||
} | ||
|
||
class TestMail extends Mailable | ||
{ | ||
public function build() | ||
{ | ||
$this->from('[email protected]') | ||
->subject('This is a subject') | ||
->html('<html>Example email content</html>'); | ||
} | ||
} |
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
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,21 @@ | ||
<?php | ||
|
||
namespace BeyondCode\Mailbox\Tests; | ||
|
||
use BeyondCode\Mailbox\MailboxServiceProvider; | ||
|
||
abstract class TestCase extends \Orchestra\Testbench\TestCase | ||
{ | ||
|
||
protected function getPackageProviders($app) | ||
{ | ||
return [MailboxServiceProvider::class]; | ||
} | ||
|
||
protected function getEnvironmentSetUp($app) | ||
{ | ||
include_once __DIR__.'/../database/migrations/create_mailbox_inbound_emails_table.php.stub'; | ||
|
||
(new \CreateMailboxInboundEmails())->up(); | ||
} | ||
} |