1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<?php
namespace Integration\Mail;
use lucatume\WPBrowser\TestCase\WPTestCase; use SolidWP\Mail\Connectors\ConnectorSMTP; use SolidWP\Mail\Repository\ProvidersRepository; use SolidWP\Mail\SolidMailer;
class SolidMailerTest extends WPTestCase {
public function testPhpmailerReplacement(): void { $repository = new ProvidersRepository(); $repository->save( new ConnectorSMTP( [ 'name' => 'other', 'is_active' => true, 'from_email' => '[email protected]', 'from_name' => 'SolidWP', 'smtp_host' => 'localhost', ] ) );
wp_mail( '[email protected]', 'Subject', 'Test' ); /** @var SolidMailer $php_mailer */ $php_mailer = tests_retrieve_phpmailer_instance(); $this->assertInstanceOf( SolidMailer::class, $php_mailer ); $this->assertEquals( 'localhost', $php_mailer->Host ); $this->assertEquals( '[email protected]', $php_mailer->From ); $this->assertEquals( 'SolidWP', $php_mailer->FromName ); } }
|