Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
importCategoryCsv example
$logfile
=
$this
->
getLogEntity
(
$progress
->
getLogId
(
)
)
->
getFile
(
)
;
static
::
assertInstanceOf
(
ImportExportFileEntity::
class
,
$logfile
)
;
$csv
=
$filesystem
->
read
(
$logfile
->
getPath
(
)
)
;
static
::
assertIsString
(
$csv
)
;
static
::
assertStringContainsString
(
";{
$newStock
}
;",
$csv
)
;
}
public
function
testImportEvents
(
)
: void
{
$this
->listener->
addSubscriber
(
new
TestSubscriber
(
)
)
;
$this
->
importCategoryCsv
(
)
;
$events
=
array_column
(
$this
->listener->
getCalledListeners
(
)
, 'event'
)
;
static
::
assertContains
(
ImportExportBeforeImportRecordEvent::
class
,
$events
)
;
static
::
assertContains
(
ImportExportAfterImportRecordEvent::
class
,
$events
)
;
static
::
assertNotContains
(
ImportExportExceptionImportRecordEvent::
class
,
$events
)
;
}
public
function
testImportExport
(
)
: void
{
/** @var FilesystemOperator $filesystem */
$filesystem
=
$this
->
getContainer
(
)
->
get
(
'shopware.filesystem.private'
)
;