Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getMediaEntity example
$this
->
getBrowser
(
)
->
request
(
'POST',
$url
. '?extension=png',
[
]
,
[
]
,
[
'HTTP_CONTENT-TYPE' => 'image/png',
'HTTP_CONTENT-LENGTH' =>
filesize
(
self::TEST_IMAGE
)
,
]
,
(string)
file_get_contents
(
self::TEST_IMAGE
)
)
;
$media
=
$this
->
getMediaEntity
(
)
;
$mediaPath
=
$this
->urlGenerator->
getRelativeMediaUrl
(
$media
)
;
static
::
assertTrue
(
$this
->
getPublicFilesystem
(
)
->
has
(
$mediaPath
)
)
;
static
::
assertStringEndsWith
(
$media
->
getId
(
)
. '.' .
$media
->
getFileExtension
(
)
,
$mediaPath
)
;
$this
->
assertMediaApiResponse
(
)
;
}
public
function
testUploadFromBinaryUsesFileName
(
)
: void
{
$dispatcher
=
$this
->
getContainer
(
)
->
get
(
'event_dispatcher'
)
;