Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isTheme example
$inheritance
=
$this
->
getThemeInheritance
(
(string)
$theme
,
$themes
)
;
foreach
(
array_keys
(
$bundles
)
as
$bundle
)
{
$key
= '@' .
$bundle
;
if
(
isset
(
$inheritance
[
$key
]
)
)
{
$inheritance
[
$key
]
[
]
=
$bundle
;
continue
;
}
if
(
$this
->
isTheme
(
$bundle
)
)
{
continue
;
}
$inheritance
[
'@Plugins'
]
[
]
=
$bundle
;
}
/* * Reverse the order here so our reversal after flattening doesn't * collaterally invert our desired plugin order. */
$inheritance
[
'@Plugins'
]
=
array_reverse
(
$inheritance
[
'@Plugins'
]
)
;
public
function
testAppNotInstalledDetectedAsTheme
(
)
: void
{
$this
->
installApp
(
__DIR__ . '/../_fixtures/TestAppTheme', false
)
;
$extensions
=
$this
->extensionLoader->
loadFromAppCollection
(
Context::
createDefaultContext
(
)
,
new
AppCollection
(
[
]
)
)
;
/** @var ExtensionStruct $extension */
$extension
=
$extensions
->
get
(
'TestAppTheme'
)
;
static
::
assertTrue
(
$extension
->
isTheme
(
)
)
;
$this
->
removeApp
(
__DIR__ . '/../_fixtures/TestAppTheme'
)
;
}
public
function
testLocalUpdateShouldSetLatestVersion
(
)
: void
{
$appManifestPath
=
$this
->
getContainer
(
)
->
getParameter
(
'kernel.app_dir'
)
. '/TestApp/manifest.xml';
$appManifestXml
=
file_get_contents
(
$appManifestPath
)
;
static
::
assertIsString
(
$appManifestXml
, 'Could not read manifest.xml file'
)
;
file_put_contents
(
$appManifestPath
,
str_replace
(
'1.0.0', '1.0.1',
$appManifestXml
)
)
;
$extensions
=
$this
->extensionLoader->
loadFromAppCollection
(
$registeredApps
=
$this
->
loadFromListingArray
(
$context
,
$data
)
;
// Enrich apps from filesystem
$localApps
=
$this
->
loadLocalAppsCollection
(
$context
)
;
foreach
(
$localApps
as
$name
=>
$app
)
{
if
(
$registeredApps
->
has
(
$name
)
)
{
/** @var ExtensionStruct $registeredApp */
$registeredApp
=
$registeredApps
->
get
(
$name
)
;
$registeredApp
->
setIsTheme
(
$app
->
isTheme
(
)
)
;
// Set version of local app to registered app if newer
if
(
version_compare
(
(string)
$app
->
getVersion
(
)
,
(string)
$registeredApp
->
getVersion
(
)
, '>'
)
)
{
$registeredApp
->
setLatestVersion
(
$app
->
getVersion
(
)
)
;
}
continue
;
}
$registeredApps
->
set
(
$name
,
$app
)
;
}
try
{
$storeExtensions
=
$this
->client->
listMyExtensions
(
$localCollection
,
$context
)
;
}
catch
(
\Throwable
)
{
return
;
}
foreach
(
$storeExtensions
->
getElements
(
)
as
$storeExtension
)
{
if
(
$localCollection
->
has
(
$storeExtension
->
getName
(
)
)
)
{
/** @var ExtensionStruct $localExtension */
$localExtension
=
$localCollection
->
get
(
$storeExtension
->
getName
(
)
)
;
$localExtension
->
setId
(
$storeExtension
->
getId
(
)
)
;
$localExtension
->
setIsTheme
(
$storeExtension
->
isTheme
(
)
)
;
$localExtension
->
setStoreExtension
(
$storeExtension
)
;
$localExtension
->
setStoreLicense
(
$storeExtension
->
getStoreLicense
(
)
)
;
$localExtension
->
setNotices
(
$storeExtension
->
getNotices
(
)
)
;
if
(
$storeExtension
->
getDescription
(
)
)
{
$localExtension
->
setDescription
(
$storeExtension
->
getDescription
(
)
)
;
}
if
(
$storeExtension
->
getShortDescription
(
)
)
{
$localExtension
->
setShortDescription
(
$storeExtension
->
getShortDescription
(
)
)
;
}