Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
DeleteNotUsedMediaCommand example
public
function
testCommandDoesNotRunIfJsonOverlapNotAvailable
(
)
: void
{
$service
=
$this
->
createMock
(
UnusedMediaPurger::
class
)
;
$connection
=
$this
->
createMock
(
Connection::
class
)
;
$connection
->
expects
(
static
::
once
(
)
)
->
method
(
'fetchOne'
)
->
with
(
'SELECT JSON_OVERLAPS(JSON_ARRAY(1), JSON_ARRAY(1));'
)
->
willThrowException
(
new
\
Exception
(
'Not available'
)
)
;
$command
=
new
DeleteNotUsedMediaCommand
(
$service
,
$connection
)
;
$commandTester
=
new
CommandTester
(
$command
)
;
$commandTester
->
execute
(
[
]
)
;
$output
=
new
BufferedOutput
(
)
;
$io
=
new
SymfonyStyle
(
new
ArrayInput
(
[
]
)
,
$output
,
)
;