Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getTestProduct example
$this
->mediaDirCreated = false;
}
}
public
function
testExportEvents
(
)
: void
{
$this
->listener->
addSubscriber
(
new
StockSubscriber
(
)
)
;
$filesystem
=
$this
->
getContainer
(
)
->
get
(
'shopware.filesystem.private'
)
;
$productId
= Uuid::
randomHex
(
)
;
$product
=
$this
->
getTestProduct
(
$productId
)
;
$newStock
=
(int)
$product
[
'stock'
]
+ 1;
$criteria
=
new
Criteria
(
[
$productId
]
)
;
$progress
=
$this
->
export
(
Context::
createDefaultContext
(
)
, ProductDefinition::ENTITY_NAME,
$criteria
)
;
$events
=
array_column
(
$this
->listener->
getCalledListeners
(
)
, 'event'
)
;
static
::
assertContains
(
ImportExportBeforeExportRecordEvent::
class
,
$events
)
;
$logfile
=
$this
->
getLogEntity
(
$progress
->
getLogId
(
)
)
->
getFile
(
)
;
static
::
assertInstanceOf
(
ImportExportFileEntity::
class
,
$logfile
)
;
$csv
=
$filesystem
->
read
(
$logfile
->
getPath
(
)
)
;