Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
SimplePlugin example
$actual
=
$event
->
getConcatenatedScripts
(
)
;
$expected
=
$scripts
. MockThemeCompilerConcatenatedSubscriber::SCRIPTS_CONCAT;
static
::
assertEquals
(
$expected
,
$actual
)
;
}
public
function
testDBException
(
)
: void
{
$configService
=
$this
->
getConfigurationServiceDbException
(
[
new
SimplePlugin
(
true, __DIR__ . '/fixtures/SimplePlugin'
)
,
]
)
;
$storefrontPluginRegistry
=
$this
->
getStorefrontPluginRegistry
(
[
new
SimplePlugin
(
true, __DIR__ . '/fixtures/SimplePlugin'
)
,
]
)
;
$subscriber
=
new
ThemeCompilerEnrichScssVarSubscriber
(
$configService
,
$storefrontPluginRegistry
)
;
$stderr
=
fopen
(
'php://stderr', 'wb'
)
;
$actual
=
json_encode
(
$resolvedFiles
, \JSON_PRETTY_PRINT
)
;
$notExpected
= '/Resources\/app\/storefront\/src\/scss\/skin\/shopware\/_base.scss';
static
::
assertStringNotContainsString
(
$notExpected
,
(string)
$actual
)
;
}
public
function
testResolvedFilesDontContainDuplicates
(
)
: void
{
$themePluginBundle
=
new
ThemeWithMultiInheritance
(
true, __DIR__ . '/fixtures/SimplePlugin'
)
;
$storefrontBundle
=
new
MockStorefront
(
)
;
$pluginBundle
=
new
SimplePlugin
(
true, __DIR__ . '/fixtures/SimplePlugin'
)
;
$projectDir
=
$this
->
getContainer
(
)
->
getParameter
(
'kernel.project_dir'
)
;
$factory
=
new
StorefrontPluginConfigurationFactory
(
$projectDir
)
;
$config
=
$factory
->
createFromBundle
(
$themePluginBundle
)
;
$storefront
=
$factory
->
createFromBundle
(
$storefrontBundle
)
;
$plugin
=
$factory
->
createFromBundle
(
$pluginBundle
)
;
$configCollection
=
new
StorefrontPluginConfigurationCollection
(
)
;
$configCollection
->
add
(
$config
)
;
$configCollection
->
add
(
$storefront
)
;
$this
->
getContainer
(
)
->
get
(
Connection::
class
)
)
;
$this
->configFactory =
$this
->
getContainer
(
)
->
get
(
StorefrontPluginConfigurationFactory::
class
)
;
$this
->
getContainer
(
)
->
get
(
Connection::
class
)
->
executeStatement
(
'DELETE FROM `theme_sales_channel`'
)
;
$this
->
assignThemeToDefaultSalesChannel
(
)
;
}
public
function
testHandleThemeInstallOrUpdateWillRecompileThemeIfNecessary
(
)
: void
{
$installConfig
=
$this
->configFactory->
createFromBundle
(
new
SimplePlugin
(
true, __DIR__ . '/fixtures/SimplePlugin'
)
)
;
$this
->themeServiceMock->
expects
(
static
::
once
(
)
)
->
method
(
'compileTheme'
)
->
with
(
TestDefaults::SALES_CHANNEL,
static
::
isType
(
'string'
)
,
static
::
isInstanceOf
(
Context::
class
)
,
static
::
callback
(
fn
(
StorefrontPluginConfigurationCollection
$configs
)
: bool =>
$configs
->
count
(
)
=== 2
)
)
;
$configs
=
new
StorefrontPluginConfigurationCollection
(
[