Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
installAndActivatePlugin example
$plugin
=
$this
->
getPlugin
(
$context
)
;
$context
->
addExtension
(
SwagTest::THROW_ERROR_ON_UPDATE,
new
ArrayStruct
(
)
)
;
$this
->
expectException
(
\BadMethodCallException::
class
)
;
$this
->
expectExceptionMessage
(
'Update throws an error'
)
;
$this
->pluginLifecycleService->
updatePlugin
(
$plugin
,
$context
)
;
}
public
function
updateActivatedPluginWithException
(
Context
$context
)
: void
{
$this
->
createPlugin
(
$this
->pluginRepo,
$this
->context, SwagTest::PLUGIN_OLD_VERSION
)
;
$activatedPlugin
=
$this
->
installAndActivatePlugin
(
$context
)
;
$context
->
addExtension
(
SwagTest::THROW_ERROR_ON_UPDATE,
new
ArrayStruct
(
)
)
;
try
{
$this
->pluginLifecycleService->
updatePlugin
(
$activatedPlugin
,
$context
)
;
}
catch
(
\Throwable
$exception
)
{
static
::
assertInstanceOf
(
\BadMethodCallException::
class
,
$exception
)
;
static
::
assertStringContainsString
(
'Update throws an error',
$exception
->
getMessage
(
)
)
;
}
$plugin
=
$this
->
getTestPlugin
(
$context
)
;