Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
bootstrap example
<?php
declare
(
strict_types=1
)
;
namespace Shopware\Core;
require
__DIR__ . '/TestBootstrapper.php';
(
new
TestBootstrapper
(
)
)
->
setPlatformEmbedded
(
false
)
->
setEnableCommercial
(
)
->
setBypassFinals
(
false
)
->
bootstrap
(
)
;
namespace Shopware\Tests\Bench;
require
__DIR__ . '/../../../src/Core/TestBootstrapper.php';
use
Shopware\Core\TestBootstrapper;
(
new
TestBootstrapper
(
)
)
->
setForceInstall
(
false
)
->
setPlatformEmbedded
(
false
)
->
setBypassFinals
(
false
)
->
bootstrap
(
)
;
$bootstrapper
=
(
new
TestBootstrapper
(
)
)
->
setOutput
(
new
ConsoleOutput
(
)
)
->
setForceInstall
(
static
::
parseEnvVar
(
'FORCE_INSTALL', true
)
)
->
setForceInstallPlugins
(
static
::
parseEnvVar
(
'FORCE_INSTALL_PLUGINS', true
)
)
->
setPlatformEmbedded
(
static
::
parseEnvVar
(
'PLATFORM_EMBEDDED'
)
)
->
setBypassFinals
(
static
::
parseEnvVar
(
'BYPASS_FINALS'
)
)
->
setEnableCommercial
(
static
::
parseEnvVar
(
'ENABLE_COMMERCIAL'
)
)
->
setLoadEnvFile
(
static
::
parseEnvVar
(
'LOAD_ENV_FILE', true
)
)
->
setProjectDir
(
$_ENV
[
'PROJECT_DIR'
]
?? null
)
->
bootstrap
(
)
;
(
new
Fixtures
(
)
)
->
load
(
__DIR__ . '/data.json'
)
;
// TODO: Resolve autoloading to [Commercial]/tests/performance/bench so native phpbench `core.extensions` can be used
$fixturePath
=
$bootstrapper
->
getProjectDir
(
)
. '/custom/plugins/SwagCommercial/tests/performance/bench/Common';
$symfonyContainer
= KernelLifecycleManager::
getKernel
(
)
->
getContainer
(
)
;
$container
->
register
(
'symfony-container',
fn
(
)
=>
$symfonyContainer
)
;
$runGroup
=
$this
->
getRunGroup
(
)
;
$originalClasses
=
get_declared_classes
(
)
;
foreach
(
$this
->
findFixtures
(
$fixturePath
)
as
$fixtureFile
)
{
require
$fixtureFile
;