Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getInvalidLogContent example
public
function
testImportExport
(
)
: void
{
/** @var FilesystemOperator $filesystem */
$filesystem
=
$this
->
getContainer
(
)
->
get
(
'shopware.filesystem.private'
)
;
$productId
= Uuid::
randomHex
(
)
;
$this
->
getTestProduct
(
$productId
)
;
$criteria
=
new
Criteria
(
[
$productId
]
)
;
$progress
=
$this
->
export
(
Context::
createDefaultContext
(
)
, ProductDefinition::ENTITY_NAME,
$criteria
)
;
static
::
assertTrue
(
$progress
->
isFinished
(
)
)
;
static
::
assertImportExportSucceeded
(
$progress
,
$this
->
getInvalidLogContent
(
$progress
->
getInvalidRecordsLogId
(
)
)
)
;
$progress
=
$this
->
export
(
Context::
createDefaultContext
(
)
, ProductDefinition::ENTITY_NAME,
$criteria
)
;
/** @var EntityRepository $fileRepository */
$fileRepository
=
$this
->
getContainer
(
)
->
get
(
'import_export_file.repository'
)
;
/** @var ImportExportFileEntity|null $file */
$file
=
$fileRepository
->
search
(
new
Criteria
(
array_filter
(
[
$this
->
getLogEntity
(
$progress
->
getLogId
(
)
)
->
getFileId
(
)
]
)
)
, Context::
createDefaultContext
(
)
)
->
first
(
)
;
static
::
assertNotNull
(
$file
)
;
$importExportFileEntity
=
$this
->
getLogEntity
(
$progress
->
getLogId
(
)
)
->
getFile
(
)
;
static
::
assertInstanceOf
(
ImportExportFileEntity::
class
,
$importExportFileEntity
)
;