Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
deactivateExtension example
public
function
deactivate
(
string
$type
, string
$technicalName
, Context
$context
)
: void
{
if
(
$type
=== 'plugin'
)
{
$plugin
=
$this
->pluginService->
getPluginByName
(
$technicalName
,
$context
)
;
$this
->pluginLifecycleService->
deactivatePlugin
(
$plugin
,
$context
)
;
return
;
}
$this
->storeAppLifecycleService->
deactivateExtension
(
$technicalName
,
$context
)
;
}
public
function
remove
(
string
$type
, string
$technicalName
, Context
$context
)
: void
{
if
(
$type
=== 'plugin'
)
{
$plugin
=
$this
->pluginService->
getPluginByName
(
$technicalName
,
$context
)
;
$this
->pluginManagementService->
deletePlugin
(
$plugin
,
$context
)
;
return
;
}
$controller
=
new
ExtensionStoreActionsController
(
$lifecycle
=
$this
->
createMock
(
ExtensionLifecycleService::
class
)
,
$this
->
createMock
(
ExtensionDownloader::
class
)
,
$this
->
createMock
(
PluginService::
class
)
,
$this
->
createMock
(
PluginManagementService::
class
)
)
;
$lifecycle
->
expects
(
static
::
once
(
)
)
->
method
(
'deactivate'
)
;
static
::
assertEquals
(
Response::HTTP_NO_CONTENT,
$controller
->
deactivateExtension
(
'plugin', 'test', Context::
createDefaultContext
(
)
)
->
getStatusCode
(
)
)
;
}
public
function
testUpdateExtensionWithConsent
(
)
: void
{
$controller
=
new
ExtensionStoreActionsController
(
$lifecycle
=
$this
->
createMock
(
ExtensionLifecycleService::
class
)
,
$this
->
createMock
(
ExtensionDownloader::
class
)
,
$this
->
createMock
(
PluginService::
class
)
,
$this
->
createMock
(
PluginManagementService::
class
)
)
;