Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getJpgWithFolderWithoutThumbnails example
static
::
assertTrue
(
$this
->
getPublicFilesystem
(
)
->
has
(
$thumbnailPath
)
)
;
$originalSize
=
$this
->
getPublicFilesystem
(
)
->
fileSize
(
$filePath
)
;
$thumbnailSize
=
$this
->
getPublicFilesystem
(
)
->
fileSize
(
$thumbnailPath
)
;
static
::
assertLessThanOrEqual
(
$originalSize
,
$thumbnailSize
)
;
}
public
function
testItUsesFolderConfigGenerateThumbnails
(
)
: void
{
$this
->
setFixtureContext
(
$this
->context
)
;
$media
=
$this
->
getJpgWithFolderWithoutThumbnails
(
)
;
$filePath
=
$this
->urlGenerator->
getRelativeMediaUrl
(
$media
)
;
$resource
=
fopen
(
__DIR__ . '/../fixtures/shopware.jpg', 'rb'
)
;
static
::
assertNotFalse
(
$resource
)
;
$this
->
getPublicFilesystem
(
)
->
writeStream
(
$filePath
,
$resource
)
;
$this
->thumbnailService->
updateThumbnails
(
$media
,
$this
->context, false
)
;
/** @var MediaEntity $updatedMedia */
$updatedMedia
=
$this
->mediaRepository->
search
(
new
Criteria
(
[
$media
->
getId
(
)
]
)
,
$this
->context
)
->
get
(
$media
->
getId
(
)
)
;