Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getTestPlugin example
$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
)
;
static
::
assertFalse
(
$plugin
->
getActive
(
)
)
;
}
public
function
updateActivatedPluginWithExceptionOnDeactivation
(
Context
$context
)
: void
{
$this
->
createPlugin
(
$this
->pluginRepo,
$context
, SwagTest::PLUGIN_OLD_VERSION
)
;
$activatedPlugin
=
$this
->
installAndActivatePlugin
(
$context
)
;
$context
->
addExtension
(
SwagTest::THROW_ERROR_ON_UPDATE,
new
ArrayStruct
(
)
)
;
$context
->
addExtension
(
SwagTest::THROW_ERROR_ON_DEACTIVATE,
new
ArrayStruct
(
)
)
;