OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
reader
/
aws-ses
/
vendor
/
phpmailer
/
phpmailer
/
test
/
PHPMailer
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/19/2025 10:07:13 AM
rwxr-xr-x
📄
AddEmbeddedImageTest.php
6.45 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
AddStringAttachmentTest.php
5.19 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
AddStringEmbeddedImageTest.php
5.53 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
AddrFormatTest.php
2.08 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
AuthCRAMMD5Test.php
1.54 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
CustomHeaderTest.php
9.2 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
DKIMTest.php
9.51 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
DSNConfiguratorTest.php
6.49 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
EncodeQTest.php
3.96 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
EncodeStringTest.php
4.58 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
FileIsAccessibleTest.php
3.32 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
FilenameToTypeTest.php
2.22 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
GenerateIdTest.php
2.63 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
GetLastMessageIDTest.php
3.32 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
HasLineLongerThanMaxTest.php
4.69 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
Html2TextTest.php
9.79 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
ICalTest.php
4.32 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
IsPermittedPathTest.php
3.74 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
IsValidHostTest.php
4.18 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
LocalizationTest.php
18.51 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
MailTransportTest.php
3.67 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
MbPathinfoTest.php
5.74 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
MimeTypesTest.php
1.93 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
NormalizeBreaksTest.php
3.62 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
PHPMailerTest.php
47.39 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
ParseAddressesTest.php
14.27 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
PunyencodeAddressTest.php
4.77 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
QuotedStringTest.php
2.08 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
ReplyToGetSetClearTest.php
17.23 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
SetErrorTest.php
5.19 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
SetFromTest.php
7.08 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
SetTest.php
2.32 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
SetWordWrapTest.php
4.01 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
Utf8CharBoundaryTest.php
1.95 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
ValidateAddressCustomValidatorTest.php
3.65 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
ValidateAddressTest.php
17.2 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
WrapTextTest.php
6.05 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
XMailerTest.php
2 KB
05/19/2025 10:07:13 AM
rw-r--r--
Editing: DSNConfiguratorTest.php
Close
<?php /** * PHPMailer - PHP email transport unit tests. * PHP version 5.5. * * @author Marcus Bointon <phpmailer@synchromedia.co.uk> * @author Andy Prevost * @copyright 2012 - 2020 Marcus Bointon * @copyright 2004 - 2009 Andy Prevost * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License */ namespace PHPMailer\Test\PHPMailer; use PHPMailer\PHPMailer\DSNConfigurator; use PHPMailer\PHPMailer\Exception; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\Test\TestCase; /** * Test configuring with DSN. * * @covers \PHPMailer\PHPMailer\DSNConfigurator */ final class DSNConfiguratorTest extends TestCase { /** * Test throwing exception if DSN is invalid. */ public function testInvalidDSN() { $configurator = new DSNConfigurator(); $this->expectException(Exception::class); $this->expectExceptionMessage('Malformed DSN'); $configurator->configure($this->Mail, 'localhost'); } /** * Test throwing exception if DSN scheme is invalid. */ public function testInvalidScheme() { $configurator = new DSNConfigurator(); $this->expectException(Exception::class); $this->expectExceptionMessage('Invalid scheme: "ftp".'); $configurator->configure($this->Mail, 'ftp://localhost'); } /** * Test cofiguring mail. */ public function testConfigureMail() { $configurator = new DSNConfigurator(); $configurator->configure($this->Mail, 'mail://localhost'); self::assertEquals($this->Mail->Mailer, 'mail'); } /** * Test cofiguring sendmail. */ public function testConfigureSendmail() { $configurator = new DSNConfigurator(); $configurator->configure($this->Mail, 'sendmail://localhost'); self::assertEquals($this->Mail->Mailer, 'sendmail'); } /** * Test cofiguring qmail. */ public function testConfigureQmail() { $configurator = new DSNConfigurator(); $configurator->configure($this->Mail, 'qmail://localhost'); self::assertEquals($this->Mail->Mailer, 'qmail'); } /** * Test cofiguring SMTP without authentication. */ public function testConfigureSmtpWithoutAuthentication() { $configurator = new DSNConfigurator(); $configurator->configure($this->Mail, 'smtp://localhost'); self::assertEquals($this->Mail->Mailer, 'smtp'); self::assertEquals($this->Mail->Host, 'localhost'); self::assertFalse($this->Mail->SMTPAuth); } /** * Test cofiguring SMTP with authentication. */ public function testConfigureSmtpWithAuthentication() { $configurator = new DSNConfigurator(); $configurator->configure($this->Mail, 'smtp://user:pass@remotehost'); self::assertEquals($this->Mail->Mailer, 'smtp'); self::assertEquals($this->Mail->Host, 'remotehost'); self::assertTrue($this->Mail->SMTPAuth); self::assertEquals($this->Mail->Username, 'user'); self::assertEquals($this->Mail->Password, 'pass'); } /** * Test cofiguring SMTP without port. */ public function testConfigureSmtpWithoutPort() { $configurator = new DSNConfigurator(); $configurator->configure($this->Mail, 'smtp://localhost'); self::assertEquals($this->Mail->Mailer, 'smtp'); self::assertEquals($this->Mail->Host, 'localhost'); self::assertEquals($this->Mail->Port, SMTP::DEFAULT_PORT); } /** * Test cofiguring SMTP with port. */ public function testConfigureSmtpWitPort() { $configurator = new DSNConfigurator(); $configurator->configure($this->Mail, 'smtp://localhost:2525'); self::assertEquals($this->Mail->Mailer, 'smtp'); self::assertEquals($this->Mail->Host, 'localhost'); self::assertEquals($this->Mail->Port, 2525); } /** * Test cofiguring SMTPs without port. */ public function testConfigureSmtpsWithoutPort() { $configurator = new DSNConfigurator(); $configurator->configure($this->Mail, 'smtps://user:pass@remotehost'); self::assertEquals($this->Mail->Mailer, 'smtp'); self::assertEquals($this->Mail->SMTPSecure, PHPMailer::ENCRYPTION_STARTTLS); self::assertEquals($this->Mail->Host, 'remotehost'); self::assertEquals($this->Mail->Port, SMTP::DEFAULT_SECURE_PORT); self::assertTrue($this->Mail->SMTPAuth); self::assertEquals($this->Mail->Username, 'user'); self::assertEquals($this->Mail->Password, 'pass'); } /** * Test cofiguring SMTPs with port. */ public function testConfigureWithUnknownOption() { $configurator = new DSNConfigurator(); $this->expectException(Exception::class); $this->expectExceptionMessage('Unknown option: "UnknownOption".'); $configurator->configure($this->Mail, 'mail://locahost?UnknownOption=Value'); } /** * Test cofiguring options with query sting. */ public function testConfigureWithOptions() { $configurator = new DSNConfigurator(); $configurator->configure( $this->Mail, 'sendmail://localhost?Sendmail=/usr/local/bin/sendmail&AllowEmpty=1&WordWrap=78' ); self::assertEquals($this->Mail->Mailer, 'sendmail'); self::assertEquals($this->Mail->Sendmail, '/usr/local/bin/sendmail'); self::assertEquals($this->Mail->AllowEmpty, true); self::assertEquals($this->Mail->WordWrap, 78); } /** * Test shortcut. */ public function testShortcut() { $mailer = DSNConfigurator::mailer('smtps://user@gmail.com:secret@smtp.gmail.com?SMTPDebug=3&Timeout=1000'); self::assertEquals($mailer->Mailer, 'smtp'); self::assertEquals($mailer->SMTPSecure, PHPMailer::ENCRYPTION_STARTTLS); self::assertEquals($mailer->Host, 'smtp.gmail.com'); self::assertEquals($mailer->Port, SMTP::DEFAULT_SECURE_PORT); self::assertTrue($mailer->SMTPAuth); self::assertEquals($mailer->Username, 'user@gmail.com'); self::assertEquals($mailer->Password, 'secret'); self::assertEquals($mailer->SMTPDebug, 3); self::assertEquals($mailer->Timeout, 1000); } }