Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
DummyStream example
$this
->
assertEquals
(
'smtps://example.com',
(string)
$t
)
;
$t
=
new
EsmtpTransport
(
'example.com', 0, false
)
;
$this
->
assertEquals
(
'smtp://example.com',
(string)
$t
)
;
$t
=
new
EsmtpTransport
(
'example.com', 466, true
)
;
$this
->
assertEquals
(
'smtps://example.com:466',
(string)
$t
)
;
}
public
function
testExtensibility
(
)
{
$stream
=
new
DummyStream
(
)
;
$transport
=
new
CustomEsmtpTransport
(
stream:
$stream
)
;
$message
=
new
Email
(
)
;
$message
->
from
(
'sender@example.org'
)
;
$message
->
addTo
(
'recipient@example.org'
)
;
$message
->
text
(
'.'
)
;
$transport
->
send
(
$message
)
;
$this
->
assertContains
(
"MAIL FROM:<sender@example.org> RET=HDRS\r\n",
$stream
->
getCommands
(
)
)
;
$this
->
assertContains
(
"RCPT TO:<recipient@example.org> NOTIFY=FAILURE\r\n",
$stream
->
getCommands
(
)
)
;
}
public
function
testToString
(
)
{
$t
=
new
SmtpTransport
(
)
;
$this
->
assertEquals
(
'smtps://localhost',
(string)
$t
)
;
$t
=
new
SmtpTransport
(
(
new
SocketStream
(
)
)
->
setHost
(
'127.0.0.1'
)
->
setPort
(
2525
)
->
disableTls
(
)
)
;
$this
->
assertEquals
(
'smtp://127.0.0.1:2525',
(string)
$t
)
;
}
public
function
testSendDoesNotPingBelowThreshold
(
)
{
$stream
=
new
DummyStream
(
)
;
$envelope
=
new
Envelope
(
new
Address
(
'sender@example.org'
)
,
[
new
Address
(
'recipient@example.org'
)
]
)
;
$transport
=
new
SmtpTransport
(
$stream
)
;
$transport
->
send
(
new
RawMessage
(
'Message 1'
)
,
$envelope
)
;
$transport
->
send
(
new
RawMessage
(
'Message 2'
)
,
$envelope
)
;
$transport
->
send
(
new
RawMessage
(
'Message 3'
)
,
$envelope
)
;
$this
->
assertNotContains
(
"NOOP\r\n",
$stream
->
getCommands
(
)
)
;
}
public
function
testSendPingAfterTransportException
(
)
{