mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 12:44:02 +00:00
Allow mapping nested tenant properties to mail config (#20)
* Use data_get() to allow mapping nested tenant attributes to mail config * Fix code style (php-cs-fixer) * Test the data_get() change * Improve code, add info to docblock --------- Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
This commit is contained in:
parent
ca400b51d2
commit
ea5a7463b8
3 changed files with 42 additions and 3 deletions
|
|
@ -54,6 +54,18 @@ test('mailer transport uses the correct credentials', function() {
|
|||
assertMailerTransportUsesPassword($newTenantPassword);
|
||||
tenancy()->end();
|
||||
|
||||
// Assert nested tenant properties can be mapped to mail config (e.g. using dot notation)
|
||||
// Add 'mail' JSON column to tenants table where smtp_password will be stored
|
||||
pest()->artisan('tenants:migrate', [
|
||||
'--path' => __DIR__ . '/Etc/mail_migrations',
|
||||
'--realpath' => true,
|
||||
])->assertExitCode(0);
|
||||
|
||||
MailTenancyBootstrapper::$credentialsMap = ['mail.mailers.smtp.password' => 'mail.smtp_password'];
|
||||
tenancy()->initialize($tenant = Tenant::create(['mail' => ['smtp_password' => $nestedTenantPassword = 'nested']]));
|
||||
assertMailerTransportUsesPassword($nestedTenantPassword);
|
||||
tenancy()->end();
|
||||
|
||||
// Assert mailer uses the default password after tenancy ends
|
||||
assertMailerTransportUsesPassword($defaultPassword);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue