-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix from_name issue for database mail
- Loading branch information
1 parent
4887f4a
commit 620b32d
Showing
3 changed files
with
33 additions
and
29 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
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 |
---|---|---|
|
@@ -2,51 +2,58 @@ | |
|
||
namespace IWasHereFirst2\LaravelMultiMail\Tests\Integration; | ||
|
||
use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables; | ||
use Illuminate\Support\Facades\View; | ||
use IWasHereFirst2\LaravelMultiMail\DatabaseConfigMailSettings; | ||
use IWasHereFirst2\LaravelMultiMail\Facades\MultiMail; | ||
use IWasHereFirst2\LaravelMultiMail\Models\EmailAccount; | ||
use IWasHereFirst2\LaravelMultiMail\Models\EmailProvider; | ||
use IWasHereFirst2\LaravelMultiMail\Tests\TestCase; | ||
use IWasHereFirst2\LaravelMultiMail\Tests\Traits\MailTrap; | ||
|
||
class MultiMailDatabaseTest extends TestCase | ||
{ | ||
const FROM = '[email protected]'; | ||
use MailTrap; | ||
const FROM = '[email protected]'; | ||
|
||
/** @test */ | ||
public function check_database_email() | ||
{ | ||
$this->artisan( | ||
'migrate', | ||
[ | ||
'--database' => 'testbench', | ||
'--realpath' => realpath(__DIR__ . '/../../src/Migrations'), | ||
] | ||
)->run(); | ||
$this->loadMigrationsFrom(realpath(__DIR__ . '/../../src/Migrations')); | ||
|
||
dd( \DB::table('email_accounts')->get()); | ||
$this->artisan('migrate',['--database' => 'testbench']) | ||
->run(); | ||
|
||
EmailAccount::create([ | ||
'email' => 'ronyPuh', | ||
'pass' => 'gomyBore', | ||
$provider = EmailProvider::create([ | ||
'host' => env('MAIL_HOST_SMTP'), | ||
'port' => env('MAIL_PORT_SMTP'), | ||
'encryption' => env('MAIL_ENCRYPTION_SMTP'), | ||
'driver' => env('MAIL_DRIVER_SMTP'), | ||
]); | ||
|
||
dd(EmailAccount::all()); | ||
|
||
EmailAccount::create([ | ||
'email' => static::FROM, | ||
'pass' => env('MAIL_PASSWORD_SMTP'), | ||
'username' => env('MAIL_USERNAME_SMTP'), | ||
'from_name' => 'Rayn Roogen', | ||
'provider_id' => $provider->id | ||
]); | ||
|
||
$to = '[email protected]'; | ||
$cc = '[email protected]'; | ||
$to = '[email protected]'; | ||
$locale = 'de'; | ||
$from = static::FROM; | ||
$bcc = ['[email protected]', '[email protected]']; | ||
|
||
MultiMail::to($to) | ||
->cc($cc) | ||
->locale($locale) | ||
->from($from) | ||
->bcc($bcc) | ||
->send(new TestMail()); | ||
|
||
$this->assertNotNull($this->emails); | ||
$this->assertEquals(1, count($this->emails)); | ||
$message = $this->findMessage('TestMail Subject'); | ||
|
||
$this->assertEquals('Rayn Roogen', $message[0]['from_name']); | ||
$this->emptyInbox(); | ||
} | ||
|
||
/** | ||
|
@@ -65,13 +72,11 @@ protected function getEnvironmentSetUp($app) | |
'prefix' => '', | ||
]); | ||
|
||
$app['config']->set('multimail.emails', | ||
['[email protected]' => [ | ||
'pass' => 'fakepass', | ||
'username' => 'fakeusername', | ||
'from' => 'Who knows', | ||
'reply_to_mail' => '[email protected]', | ||
]]); | ||
$app->useEnvironmentPath(__DIR__ . '/..'); | ||
$app->bootstrapWith([LoadEnvironmentVariables::class]); | ||
|
||
$app['config']->set('multimail.mail_settings_class', | ||
DatabaseConfigMailSettings::class); | ||
|
||
$app['config']->set('multimail.provider.default', [ | ||
'driver' => 'log', | ||
|
@@ -81,6 +86,4 @@ protected function getEnvironmentSetUp($app) | |
|
||
View::addLocation(__DIR__ . '/../Fixtures'); | ||
} | ||
|
||
|
||
} |