Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getMediaWithProduct example
$this
->mediaRepo,
$this
->
getContainer
(
)
->
get
(
'media_default_folder.repository'
)
)
;
}
public
function
testCountNotUsedMedia
(
)
: void
{
$this
->
setFixtureContext
(
$this
->context
)
;
$this
->
getTxt
(
)
;
$this
->
getPngWithoutExtension
(
)
;
$this
->
getMediaWithProduct
(
)
;
$this
->
getMediaWithManufacturer
(
)
;
static
::
assertEquals
(
2,
$this
->deleteMediaService->
countNotUsedMedia
(
$this
->context
)
)
;
}
public
function
testDeleteNotUsedMedia
(
)
: void
{
$this
->
setFixtureContext
(
$this
->context
)
;
$txt
=
$this
->
getTxt
(
)
;
$png
=
$this
->
getPng
(
)
;
$this
->mediaRepo,
new
EventDispatcher
(
)
)
;
}
public
function
testDeleteNotUsedMedia
(
)
: void
{
$this
->
setFixtureContext
(
$this
->context
)
;
$txt
=
$this
->
getTxt
(
)
;
$png
=
$this
->
getPng
(
)
;
$withProduct
=
$this
->
getMediaWithProduct
(
)
;
$withManufacturer
=
$this
->
getMediaWithManufacturer
(
)
;
$urlGenerator
=
$this
->
getContainer
(
)
->
get
(
UrlGeneratorInterface::
class
)
;
$firstPath
=
$urlGenerator
->
getRelativeMediaUrl
(
$txt
)
;
$secondPath
=
$urlGenerator
->
getRelativeMediaUrl
(
$png
)
;
$thirdPath
=
$urlGenerator
->
getRelativeMediaUrl
(
$withProduct
)
;
$fourthPath
=
$urlGenerator
->
getRelativeMediaUrl
(
$withManufacturer
)
;
$this
->
getPublicFilesystem
(
)
->
writeStream
(
$firstPath
, \
fopen
(
self::FIXTURE_FILE, 'rb'
)
)
;
$this
->
getPublicFilesystem
(
)
->
writeStream
(
$secondPath
, \
fopen
(
self::FIXTURE_FILE, 'rb'
)
)
;
$this
->
getPublicFilesystem
(
)
->
writeStream
(
$thirdPath
, \
fopen
(
self::FIXTURE_FILE, 'rb'
)
)
;