Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
InheritanceWithConfig example
$this
->themeRegistryMock =
$this
->
createMock
(
StorefrontPluginRegistry::
class
)
;
$this
->builder =
new
ThemeInheritanceBuilder
(
$this
->themeRegistryMock
)
;
$this
->configFactory =
$this
->
getContainer
(
)
->
get
(
StorefrontPluginConfigurationFactory::
class
)
;
}
public
function
testInheritanceWithConfig
(
)
: void
{
$configs
=
new
StorefrontPluginConfigurationCollection
(
[
$this
->configFactory->
createFromBundle
(
new
Storefront
(
)
)
,
$this
->configFactory->
createFromBundle
(
new
InheritanceWithConfig
(
)
)
,
]
)
;
$this
->themeRegistryMock->
method
(
'getConfigurations'
)
->
willReturn
(
$configs
)
;
$inheritance
=
$this
->builder->
build
(
[
'InheritanceWithConfig' => 1, 'Storefront' => 1
]
,
[
'InheritanceWithConfig' => true, 'Storefront' => true
]
)
;
static
::
assertEquals
(
[
'InheritanceWithConfig', 'Storefront'
]
,
array_keys
(
$inheritance
)
)
;
}
$configs
=
new
StorefrontPluginConfigurationCollection
(
[
$this
->configFactory->
createFromBundle
(
new
Storefront
(
)
)
,
$installConfig
,
]
)
;
$this
->themeLifecycleHandler->
handleThemeInstallOrUpdate
(
$installConfig
,
$configs
, Context::
createDefaultContext
(
)
)
;
}
public
function
testHandleThemeInstallOrUpdateWithInheritance
(
)
: void
{
$installConfig
=
$this
->configFactory->
createFromBundle
(
new
InheritanceWithConfig
(
)
)
;
$configs
=
new
StorefrontPluginConfigurationCollection
(
[
$this
->configFactory->
createFromBundle
(
new
Storefront
(
)
)
,
$installConfig
,
]
)
;
$this
->themeLifecycleHandler->
handleThemeInstallOrUpdate
(
$installConfig
,
$configs
, Context::
createDefaultContext
(
)
)
;
/** @var EntityRepository $themeRepository */
$themeRepository
=
$this
->
getContainer
(
)
->
get
(
'theme.repository'
)
;
$context
= Context::
createDefaultContext
(
)
;