Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getIdCriteria example
protected
function
setUp
(
)
: void
{
$this
->repository =
$this
->
getContainer
(
)
->
get
(
'media.repository'
)
;
$this
->context = Context::
createDefaultContext
(
)
;
}
public
function
testWriteReadMinimalFields
(
)
: void
{
$media
=
$this
->
getEmptyMedia
(
)
;
$criteria
=
$this
->
getIdCriteria
(
$media
->
getId
(
)
)
;
$result
=
$this
->repository->
search
(
$criteria
,
$this
->context
)
;
$media
=
$result
->
getEntities
(
)
->
first
(
)
;
static
::
assertInstanceOf
(
MediaEntity::
class
,
$media
)
;
static
::
assertEquals
(
$media
->
getId
(
)
,
$media
->
getId
(
)
)
;
}
public
function
testThumbnailsAreConvertedToStructWhenFetchedFromDb
(
)
: void
{
$this
->
setFixtureContext
(
$this
->context
)
;
$media
=
$this
->
getMediaWithThumbnail
(
)
;