mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
feat(Mailer): implement caching
Currently $this->instance is never set, so the code is no-op. This
brings back caching of the instance.
Caching broke with
be7db1573d
Swift to \Swift_Mailer as abstraction
Signed-off-by: Thomas Lehmann <t.lehmann@strato.de>
This commit is contained in:
parent
6559c2075e
commit
46d8a7333b
2 changed files with 9 additions and 1 deletions
|
|
@ -267,7 +267,9 @@ class Mailer implements IMailer {
|
|||
break;
|
||||
}
|
||||
|
||||
return new SymfonyMailer($transport);
|
||||
$this->instance = new SymfonyMailer($transport);
|
||||
|
||||
return $this->instance;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -337,4 +337,10 @@ class MailerTest extends TestCase {
|
|||
self::assertInstanceOf(EsmtpTransport::class, $transport);
|
||||
self::assertEquals('[127.0.0.1]', $transport->getLocalDomain());
|
||||
}
|
||||
|
||||
public function testCaching(): void {
|
||||
$symfonyMailer1 = self::invokePrivate($this->mailer, 'getInstance');
|
||||
$symfonyMailer2 = self::invokePrivate($this->mailer, 'getInstance');
|
||||
self::assertSame($symfonyMailer1, $symfonyMailer2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue