Currently $this->instance is never set, so the code is no-op. This
brings back caching of the instance.
Caching broke with
be7db1573dc8c6e7309ec9db124a7a74b8b41199
Swift to \Swift_Mailer as abstraction
Signed-off-by: Thomas Lehmann <t.lehmann@strato.de>
break;
}
- return new SymfonyMailer($transport);
+ $this->instance = new SymfonyMailer($transport);
+
+ return $this->instance;
}
/**
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);
+ }
}