Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getSent example
$mailFilterEvent
=
$event
;
}
)
;
static
::
assertIsString
(
$documentIdNewer
)
;
static
::
assertIsString
(
$documentIdOlder
)
;
$criteria
=
new
Criteria
(
array_filter
(
[
$documentIdOlder
,
$documentIdNewer
]
)
)
;
$documents
=
$documentRepository
->
search
(
$criteria
,
$context
)
;
$newDocument
=
$documents
->
get
(
$documentIdNewer
)
;
static
::
assertNotNull
(
$newDocument
)
;
static
::
assertInstanceOf
(
DocumentEntity::
class
,
$newDocument
)
;
static
::
assertFalse
(
$newDocument
->
getSent
(
)
)
;
$newDocumentOrderVersionId
=
$newDocument
->
getOrderVersionId
(
)
;
$oldDocument
=
$documents
->
get
(
$documentIdOlder
)
;
static
::
assertInstanceOf
(
DocumentEntity::
class
,
$oldDocument
)
;
static
::
assertFalse
(
$oldDocument
->
getSent
(
)
)
;
$oldDocumentOrderVersionId
=
$oldDocument
->
getOrderVersionId
(
)
;
// new version is created
static
::
assertNotEquals
(
$newDocumentOrderVersionId
, Defaults::LIVE_VERSION
)
;
static
::
assertNotEquals
(
$oldDocumentOrderVersionId
, Defaults::LIVE_VERSION
)
;
protected
function
setUp
(
)
: void
{
$this
->serializer =
$this
->
createMock
(
SerializerInterface::
class
)
;
$this
->transport =
new
InMemoryTransport
(
)
;
$this
->serializeTransport =
new
InMemoryTransport
(
$this
->serializer
)
;
}
public
function
testSend
(
)
{
$envelope
=
new
Envelope
(
new
\
stdClass
(
)
)
;
$this
->transport->
send
(
$envelope
)
;
$this
->
assertEquals
(
[
$envelope
->
with
(
new
TransportMessageIdStamp
(
1
)
)
]
,
$this
->transport->
getSent
(
)
)
;
}
public
function
testSendWithSerialization
(
)
{
$envelope
=
new
Envelope
(
new
\
stdClass
(
)
)
;
$envelopeDecoded
= Envelope::
wrap
(
new
DummyMessage
(
'Hello.'
)
)
;
$this
->serializer
->
method
(
'encode'
)
->
with
(
$this
->
equalTo
(
$envelope
->
with
(
new
TransportMessageIdStamp
(
1
)
)
)
)
->
willReturn
(
[
'foo' => 'ba'
]
)
;