diff --git a/.gitignore b/.gitignore index 829a5d4d7..664f929ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,8 @@ -/bin/* -!/bin/.gitkeep - /vendor/ /node_modules/ /composer.lock /etc/build/* -!/etc/build/.gitkeep +!/etc/build/.gitignore /tests/Application/yarn.lock diff --git a/.travis.yml b/.travis.yml index 2119593a6..c0c084a8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,9 @@ before_install: - echo "memory_limit=4096M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - mkdir -p "${SYLIUS_CACHE_DIR}" + - cp tests/Application/.env.test.dist tests/Application/.env.test + - set -a && source tests/Application/.env.test && set +a + install: - composer require "symfony/symfony:${SYMFONY_VERSION}" --no-interaction --no-update - composer install --no-interaction --prefer-dist @@ -34,7 +37,7 @@ install: before_script: - (cd tests/Application && bin/console doctrine:database:create --env=test -vvv) - (cd tests/Application && bin/console doctrine:schema:create --env=test -vvv) - - (cd tests/Application && bin/console assets:install web --env=test -vvv) + - (cd tests/Application && bin/console assets:install public --env=test -vvv) - (cd tests/Application && bin/console cache:warmup --env=test -vvv) - (cd tests/Application && yarn build) @@ -65,15 +68,15 @@ before_script: - java -Dwebdriver.chrome.driver=$SYLIUS_CACHE_DIR/chromedriver -jar $SYLIUS_CACHE_DIR/selenium.jar > /dev/null 2>&1 & # Run webserver - - (cd tests/Application && bin/console server:run 127.0.0.1:8080 -d web --env=test --quiet > /dev/null 2>&1 &) + - (cd tests/Application && bin/console server:run 127.0.0.1:8080 -d public --env=test --quiet > /dev/null 2>&1 &) script: - composer validate --strict - - bin/phpstan.phar analyse -c phpstan.neon -l max src/ + - vendor/bin/phpstan analyse -c phpstan.neon -l max src/ - - bin/phpunit - - bin/phpspec run - - bin/behat --strict -vvv --no-interaction || bin/behat --strict -vvv --no-interaction --rerun + - vendor/bin/phpunit + - vendor/bin/phpspec run + - vendor/bin/behat --strict -vvv --no-interaction || vendor/bin/behat --strict -vvv --no-interaction --rerun after_failure: - vendor/lakion/mink-debug-extension/travis/tools/upload-textfiles "${SYLIUS_BUILD_DIR}/*.log" diff --git a/behat.yml.dist b/behat.yml.dist index 01c63a768..d6bf7f98b 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -10,10 +10,13 @@ default: - tests/Behat/Resources/services.xml FriendsOfBehat\SymfonyExtension: + env_file: tests/Application/.env.test kernel: - class: AppKernel - path: tests/Application/app/AppKernel.php - bootstrap: vendor/autoload.php + env: test + debug: true + class: Tests\Acme\SyliusExamplePlugin\Application\Kernel + path: tests/Application/Kernel.php + bootstrap: ~ Lakion\Behat\MinkDebugExtension: directory: etc/build diff --git a/composer.json b/composer.json index 82d3816c9..49abd58a2 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,13 @@ "phpstan/phpstan-symfony": "^0.10", "phpstan/phpstan-webmozart-assert": "^0.10", "phpunit/phpunit": "^6.5", - "sylius-labs/coding-standard": "^2.0" + "sylius-labs/coding-standard": "^2.0", + "symfony/browser-kit": "^3.4|^4.1", + "symfony/debug-bundle": "^3.4|^4.1", + "symfony/dotenv": "^3.4|^4.1", + "symfony/intl": "^3.4|^4.1", + "symfony/web-profiler-bundle": "^3.4|^4.1", + "symfony/web-server-bundle": "^3.4|^4.1" }, "prefer-stable": true, "autoload": { @@ -36,15 +42,9 @@ "Tests\\Acme\\SyliusExamplePlugin\\": "tests/" } }, - "autoload-dev": { - "classmap": ["tests/Application/app/AppKernel.php"] - }, "extra": { "branch-alias": { "dev-master": "1.3-dev" } - }, - "config": { - "bin-dir": "bin" } } diff --git a/bin/.gitkeep b/etc/build/.gitignore similarity index 100% rename from bin/.gitkeep rename to etc/build/.gitignore diff --git a/phpstan.neon b/phpstan.neon index 62929fd9a..5d1d45078 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -7,7 +7,7 @@ parameters: reportUnmatchedIgnoredErrors: false symfony: - container_xml_path: tests/Application/var/cache/test/appTestDebugProjectContainer.xml + container_xml_path: tests/Application/var/cache/test/ApplicationTestDebugProjectContainer.xml excludes_analyse: # Makes PHPStan crash diff --git a/tests/Application/.env.dist b/tests/Application/.env.dist new file mode 100644 index 000000000..1465c68e8 --- /dev/null +++ b/tests/Application/.env.dist @@ -0,0 +1,23 @@ +# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file +# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production. +# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration + +###> symfony/framework-bundle ### +APP_ENV=dev +APP_DEBUG=1 +APP_SECRET=EDITME +###< symfony/framework-bundle ### + +###> doctrine/doctrine-bundle ### +# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url +# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db" +# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls +DATABASE_URL=mysql://root@127.0.0.1/sylius_%kernel.environment%?serverVersion=5.5 +###< doctrine/doctrine-bundle ### + +###> symfony/swiftmailer-bundle ### +# For Gmail as a transport, use: "gmail://username:password@localhost" +# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" +# Delivery is disabled by default via "null://localhost" +MAILER_URL=smtp://localhost +###< symfony/swiftmailer-bundle ### diff --git a/tests/Application/.env.prod.dist b/tests/Application/.env.prod.dist new file mode 100644 index 000000000..2e672003d --- /dev/null +++ b/tests/Application/.env.prod.dist @@ -0,0 +1,23 @@ +# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file +# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production. +# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration + +###> symfony/framework-bundle ### +APP_ENV=prod +APP_DEBUG=0 +APP_SECRET=EDITME +###< symfony/framework-bundle ### + +###> doctrine/doctrine-bundle ### +# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url +# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db" +# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls +DATABASE_URL=mysql://root@127.0.0.1/sylius_%kernel.environment%?serverVersion=5.5 +###< doctrine/doctrine-bundle ### + +###> symfony/swiftmailer-bundle ### +# For Gmail as a transport, use: "gmail://username:password@localhost" +# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" +# Delivery is disabled by default via "null://localhost" +MAILER_URL=smtp://localhost +###< symfony/swiftmailer-bundle ### diff --git a/tests/Application/.env.test.dist b/tests/Application/.env.test.dist new file mode 100644 index 000000000..7ef5bb538 --- /dev/null +++ b/tests/Application/.env.test.dist @@ -0,0 +1,23 @@ +# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file +# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production. +# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration + +###> symfony/framework-bundle ### +APP_ENV=test +APP_DEBUG=1 +APP_SECRET=EDITME +###< symfony/framework-bundle ### + +###> doctrine/doctrine-bundle ### +# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url +# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db" +# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls +DATABASE_URL=mysql://root@127.0.0.1/sylius_%kernel.environment%?serverVersion=5.5 +###< doctrine/doctrine-bundle ### + +###> symfony/swiftmailer-bundle ### +# For Gmail as a transport, use: "gmail://username:password@localhost" +# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" +# Delivery is disabled by default via "null://localhost" +MAILER_URL=null://localhost +###< symfony/swiftmailer-bundle ### diff --git a/tests/Application/.gitignore b/tests/Application/.gitignore index fdcfd5793..f2141177f 100644 --- a/tests/Application/.gitignore +++ b/tests/Application/.gitignore @@ -1,12 +1,17 @@ -/node_modules/ - /var/* -!/var/.gitkeep +!/var/.gitignore + +/public/assets +/public/bundles +/public/css +/public/js +/public/media + +/vendor +/node_modules -/web/* -!/web/assets/.gitkeep -!/web/bundles/.gitkeep -!/web/media/image/.gitkeep -!/web/app.php -!/web/app_dev.php -!/web/app_test.php +/.env +/.env.prod +/.env.staging +/.env.test +/.env.test_cached diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php new file mode 100644 index 000000000..680899bd1 --- /dev/null +++ b/tests/Application/Kernel.php @@ -0,0 +1,144 @@ +getProjectDir() . '/var/cache/' . $this->environment; + } + + public function getLogDir(): string + { + return $this->getProjectDir() . '/var/log'; + } + + public function registerBundles(): iterable + { + $contents = require $this->getProjectDir() . '/config/bundles.php'; + foreach ($contents as $class => $envs) { + if (isset($envs['all']) || isset($envs[$this->environment])) { + yield new $class(); + } + } + } + + public function shutdown(): void + { + if (!$this->isTestEnvironment()) { + parent::shutdown(); + + return; + } + + if (false === $this->booted) { + return; + } + + $container = $this->getContainer(); + + parent::shutdown(); + + $this->cleanupContainer($container); + } + + protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void + { + $container->addResource(new FileResource($this->getProjectDir() . '/config/bundles.php')); + $container->setParameter('container.dumper.inline_class_loader', true); + $confDir = $this->getProjectDir() . '/config'; + + $loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob'); + $loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob'); + $loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob'); + $loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob'); + } + + protected function configureRoutes(RouteCollectionBuilder $routes): void + { + $confDir = $this->getProjectDir() . '/config'; + + $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob'); + $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob'); + $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob'); + } + + protected function getContainerBaseClass(): string + { + if ($this->isTestEnvironment()) { + return MockerContainer::class; + } + + return parent::getContainerBaseClass(); + } + + private function isTestEnvironment(): bool + { + return 0 === strpos($this->getEnvironment(), 'test'); + } + + /** + * Remove all container references from all loaded services + */ + private function cleanupContainer(ContainerInterface $container): void + { + $containerReflection = new \ReflectionObject($container); + $containerServicesPropertyReflection = $containerReflection->getProperty('services'); + $containerServicesPropertyReflection->setAccessible(true); + + $services = $containerServicesPropertyReflection->getValue($container) ?: []; + foreach ($services as $serviceId => $service) { + if (null === $service) { + continue; + } + + if (in_array($serviceId, self::IGNORED_SERVICES_DURING_CLEANUP, true)) { + continue; + } + + $serviceReflection = new \ReflectionObject($service); + + if ($serviceReflection->implementsInterface(VirtualProxyInterface::class)) { + continue; + } + + $servicePropertiesReflections = $serviceReflection->getProperties(); + $servicePropertiesDefaultValues = $serviceReflection->getDefaultProperties(); + foreach ($servicePropertiesReflections as $servicePropertyReflection) { + $defaultPropertyValue = null; + if (isset($servicePropertiesDefaultValues[$servicePropertyReflection->getName()])) { + $defaultPropertyValue = $servicePropertiesDefaultValues[$servicePropertyReflection->getName()]; + } + + $servicePropertyReflection->setAccessible(true); + $servicePropertyReflection->setValue($service, $defaultPropertyValue); + } + } + + $containerServicesPropertyReflection->setValue($container, null); + } +} diff --git a/tests/Application/app/AppKernel.php b/tests/Application/app/AppKernel.php deleted file mode 100644 index f214724b2..000000000 --- a/tests/Application/app/AppKernel.php +++ /dev/null @@ -1,38 +0,0 @@ -load($this->getProjectDir() . '/app/config/config_' . $this->environment . '.yml'); - } - - public function getProjectDir(): string - { - return dirname(__DIR__); - } -} diff --git a/tests/Application/app/config/config.yml b/tests/Application/app/config/config.yml deleted file mode 100644 index d4c252820..000000000 --- a/tests/Application/app/config/config.yml +++ /dev/null @@ -1,76 +0,0 @@ -parameters: - locale: en_US - secret: "Heron is the best animal in the world!" - -imports: - - { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" } - - { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" } - - { resource: "@SyliusShopBundle/Resources/config/app/config.yml" } - - { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" } - - - { resource: "../../../../vendor/sylius/sylius/app/config/security.yml" } - -framework: - translator: { fallbacks: ["%locale%", "en"] } - secret: "%secret%" - router: - resource: "%kernel.project_dir%/app/config/routing.yml" - strict_requirements: "%kernel.debug%" - form: true - csrf_protection: true - validation: { enable_annotations: true } - templating: { engines: ["twig"] } - default_locale: "%locale%" - session: - storage_id: session.storage.mock_file - test: ~ - -monolog: - handlers: - main: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug - firephp: - type: firephp - level: info - -swiftmailer: - disable_delivery: true - logging: true - spool: - type: file - path: "%kernel.cache_dir%/spool" - -doctrine: - dbal: - driver: "pdo_sqlite" - path: "%kernel.project_dir%/var/db.sql" - charset: UTF8 - -fos_rest: - exception: ~ - view: - formats: - json: true - xml: true - empty_content: 204 - format_listener: - rules: - - { path: '^/api', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true } - - { path: '^/', stop: true } - -sylius_theme: - sources: - test: ~ - -liip_imagine: - resolvers: - default: - web_path: - web_root: "%kernel.project_dir%/web" - cache_prefix: "media/cache" - -sylius_shop: - product_grid: - include_all_descendants: true diff --git a/tests/Application/app/config/config_dev.yml b/tests/Application/app/config/config_dev.yml deleted file mode 100644 index 3cd47378b..000000000 --- a/tests/Application/app/config/config_dev.yml +++ /dev/null @@ -1,16 +0,0 @@ -imports: - - { resource: "config.yml" } - -doctrine: - dbal: - path: "%kernel.project_dir%/var/db_dev.sql" - -web_profiler: - toolbar: true - intercept_redirects: false - -framework: - router: - resource: "%kernel.project_dir%/app/config/routing_dev.yml" - profiler: - enabled: true diff --git a/tests/Application/app/config/config_test.yml b/tests/Application/app/config/config_test.yml deleted file mode 100644 index 8214673eb..000000000 --- a/tests/Application/app/config/config_test.yml +++ /dev/null @@ -1,6 +0,0 @@ -imports: - - { resource: "config.yml" } - -doctrine: - dbal: - path: "%kernel.project_dir%/var/db_test.sql" diff --git a/tests/Application/app/config/routing_dev.yml b/tests/Application/app/config/routing_dev.yml deleted file mode 100644 index 9e4d04f6e..000000000 --- a/tests/Application/app/config/routing_dev.yml +++ /dev/null @@ -1,5 +0,0 @@ -_main: - resource: routing.yml - -sylius: - resource: "../../../../vendor/sylius/sylius/app/config/routing_dev.yml" diff --git a/tests/Application/bin/console b/tests/Application/bin/console index 7a7836d04..c0fb647c0 100755 --- a/tests/Application/bin/console +++ b/tests/Application/bin/console @@ -1,27 +1,41 @@ #!/usr/bin/env php load(__DIR__.'/../.env'); +} $input = new ArgvInput(); -$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev'); -$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod'; +$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev', true); +$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption('--no-debug', true); if ($debug) { - Debug::enable(); + umask(0000); + + if (class_exists(Debug::class)) { + Debug::enable(); + } } -$kernel = new AppKernel($env, $debug); +$kernel = new Kernel($env, $debug); $application = new Application($kernel); $application->run($input); diff --git a/tests/Application/composer.json b/tests/Application/composer.json new file mode 100644 index 000000000..326735f58 --- /dev/null +++ b/tests/Application/composer.json @@ -0,0 +1,5 @@ +{ + "name": "sylius/plugin-skeleton-test-application", + "description": "Sylius application for plugin testing purposes (composer.json needed for project dir resolving)", + "license": "MIT" +} diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php new file mode 100644 index 000000000..2c7359b90 --- /dev/null +++ b/tests/Application/config/bundles.php @@ -0,0 +1,59 @@ + ['all' => true], + Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], + Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], + Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], + Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], + Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], + Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true], + Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true], + Sylius\Bundle\MoneyBundle\SyliusMoneyBundle::class => ['all' => true], + Sylius\Bundle\CurrencyBundle\SyliusCurrencyBundle::class => ['all' => true], + Sylius\Bundle\LocaleBundle\SyliusLocaleBundle::class => ['all' => true], + Sylius\Bundle\ProductBundle\SyliusProductBundle::class => ['all' => true], + Sylius\Bundle\ChannelBundle\SyliusChannelBundle::class => ['all' => true], + Sylius\Bundle\AttributeBundle\SyliusAttributeBundle::class => ['all' => true], + Sylius\Bundle\TaxationBundle\SyliusTaxationBundle::class => ['all' => true], + Sylius\Bundle\ShippingBundle\SyliusShippingBundle::class => ['all' => true], + Sylius\Bundle\PaymentBundle\SyliusPaymentBundle::class => ['all' => true], + Sylius\Bundle\MailerBundle\SyliusMailerBundle::class => ['all' => true], + Sylius\Bundle\PromotionBundle\SyliusPromotionBundle::class => ['all' => true], + Sylius\Bundle\AddressingBundle\SyliusAddressingBundle::class => ['all' => true], + Sylius\Bundle\InventoryBundle\SyliusInventoryBundle::class => ['all' => true], + Sylius\Bundle\TaxonomyBundle\SyliusTaxonomyBundle::class => ['all' => true], + Sylius\Bundle\UserBundle\SyliusUserBundle::class => ['all' => true], + Sylius\Bundle\CustomerBundle\SyliusCustomerBundle::class => ['all' => true], + Sylius\Bundle\UiBundle\SyliusUiBundle::class => ['all' => true], + Sylius\Bundle\ReviewBundle\SyliusReviewBundle::class => ['all' => true], + Sylius\Bundle\CoreBundle\SyliusCoreBundle::class => ['all' => true], + Sylius\Bundle\ResourceBundle\SyliusResourceBundle::class => ['all' => true], + Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], + winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class => ['all' => true], + Sonata\CoreBundle\SonataCoreBundle::class => ['all' => true], + Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true], + Sonata\IntlBundle\SonataIntlBundle::class => ['all' => true], + Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle::class => ['all' => true], + JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true], + FOS\RestBundle\FOSRestBundle::class => ['all' => true], + Knp\Bundle\GaufretteBundle\KnpGaufretteBundle::class => ['all' => true], + Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true], + Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true], + Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true], + Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], + WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true], + Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], + Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['all' => true], + Sylius\Bundle\FixturesBundle\SyliusFixturesBundle::class => ['all' => true], + Sylius\Bundle\PayumBundle\SyliusPayumBundle::class => ['all' => true], + Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true], + Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['all' => true], + Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true], + Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true], + FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true], + Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true], + Acme\SyliusExamplePlugin\AcmeSyliusExamplePlugin::class => ['all' => true], + Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], + Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], +]; diff --git a/tests/Application/config/packages/_sylius.yaml b/tests/Application/config/packages/_sylius.yaml new file mode 100644 index 000000000..89674acca --- /dev/null +++ b/tests/Application/config/packages/_sylius.yaml @@ -0,0 +1,14 @@ +imports: + - { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" } + + - { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" } + - { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" } + + - { resource: "@SyliusShopBundle/Resources/config/app/config.yml" } + +parameters: + sylius_core.public_dir: '%kernel.project_dir%/public' + +sylius_shop: + product_grid: + include_all_descendants: true diff --git a/tests/Application/config/packages/dev/framework.yaml b/tests/Application/config/packages/dev/framework.yaml new file mode 100644 index 000000000..4b116defd --- /dev/null +++ b/tests/Application/config/packages/dev/framework.yaml @@ -0,0 +1,2 @@ +framework: + profiler: { only_exceptions: false } diff --git a/tests/Application/config/packages/dev/jms_serializer.yaml b/tests/Application/config/packages/dev/jms_serializer.yaml new file mode 100644 index 000000000..353e46027 --- /dev/null +++ b/tests/Application/config/packages/dev/jms_serializer.yaml @@ -0,0 +1,7 @@ +jms_serializer: + visitors: + json: + options: + - JSON_PRETTY_PRINT + - JSON_UNESCAPED_SLASHES + - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/packages/dev/monolog.yaml b/tests/Application/config/packages/dev/monolog.yaml new file mode 100644 index 000000000..da2b092de --- /dev/null +++ b/tests/Application/config/packages/dev/monolog.yaml @@ -0,0 +1,9 @@ +monolog: + handlers: + main: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: debug + firephp: + type: firephp + level: info diff --git a/tests/Application/config/packages/dev/routing.yaml b/tests/Application/config/packages/dev/routing.yaml new file mode 100644 index 000000000..4116679a2 --- /dev/null +++ b/tests/Application/config/packages/dev/routing.yaml @@ -0,0 +1,3 @@ +framework: + router: + strict_requirements: true diff --git a/tests/Application/config/packages/dev/swiftmailer.yaml b/tests/Application/config/packages/dev/swiftmailer.yaml new file mode 100644 index 000000000..f43807805 --- /dev/null +++ b/tests/Application/config/packages/dev/swiftmailer.yaml @@ -0,0 +1,2 @@ +swiftmailer: + disable_delivery: true diff --git a/tests/Application/config/packages/dev/web_profiler.yaml b/tests/Application/config/packages/dev/web_profiler.yaml new file mode 100644 index 000000000..1f1cb2bb4 --- /dev/null +++ b/tests/Application/config/packages/dev/web_profiler.yaml @@ -0,0 +1,3 @@ +web_profiler: + toolbar: true + intercept_redirects: false diff --git a/tests/Application/config/packages/doctrine.yaml b/tests/Application/config/packages/doctrine.yaml new file mode 100644 index 000000000..f51ba5a22 --- /dev/null +++ b/tests/Application/config/packages/doctrine.yaml @@ -0,0 +1,14 @@ +parameters: + # Adds a fallback DATABASE_URL if the env var is not set. + # This allows you to run cache:warmup even if your + # environment variables are not available yet. + # You should not need to change this value. + env(DATABASE_URL): '' + +doctrine: + dbal: + driver: 'pdo_mysql' + server_version: '5.7' + charset: UTF8 + + url: '%env(resolve:DATABASE_URL)%' diff --git a/tests/Application/config/packages/doctrine_migrations.yaml b/tests/Application/config/packages/doctrine_migrations.yaml new file mode 100644 index 000000000..c0a120269 --- /dev/null +++ b/tests/Application/config/packages/doctrine_migrations.yaml @@ -0,0 +1,5 @@ +doctrine_migrations: + dir_name: "%kernel.project_dir%/src/Migrations" + + # Namespace is arbitrary but should be different from App\Migrations as migrations classes should NOT be autoloaded + namespace: DoctrineMigrations diff --git a/tests/Application/config/packages/fos_rest.yaml b/tests/Application/config/packages/fos_rest.yaml new file mode 100644 index 000000000..a72eef7c7 --- /dev/null +++ b/tests/Application/config/packages/fos_rest.yaml @@ -0,0 +1,11 @@ +fos_rest: + exception: true + view: + formats: + json: true + xml: true + empty_content: 204 + format_listener: + rules: + - { path: '^/api/.*', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true } + - { path: '^/', stop: true } diff --git a/tests/Application/config/packages/framework.yaml b/tests/Application/config/packages/framework.yaml new file mode 100644 index 000000000..e74ed811e --- /dev/null +++ b/tests/Application/config/packages/framework.yaml @@ -0,0 +1,7 @@ +framework: + secret: '%env(APP_SECRET)%' + form: true + csrf_protection: true + templating: { engines: ["twig"] } + session: + handler_id: ~ diff --git a/tests/Application/config/packages/jms_serializer.yaml b/tests/Application/config/packages/jms_serializer.yaml new file mode 100644 index 000000000..64dd8d103 --- /dev/null +++ b/tests/Application/config/packages/jms_serializer.yaml @@ -0,0 +1,4 @@ +jms_serializer: + visitors: + xml: + format_output: '%kernel.debug%' diff --git a/tests/Application/config/packages/liip_imagine.yaml b/tests/Application/config/packages/liip_imagine.yaml new file mode 100644 index 000000000..bb2e7ceb9 --- /dev/null +++ b/tests/Application/config/packages/liip_imagine.yaml @@ -0,0 +1,6 @@ +liip_imagine: + resolvers: + default: + web_path: + web_root: "%kernel.project_dir%/public" + cache_prefix: "media/cache" diff --git a/tests/Application/config/packages/prod/doctrine.yaml b/tests/Application/config/packages/prod/doctrine.yaml new file mode 100644 index 000000000..2f16f0fde --- /dev/null +++ b/tests/Application/config/packages/prod/doctrine.yaml @@ -0,0 +1,31 @@ +doctrine: + orm: + metadata_cache_driver: + type: service + id: doctrine.system_cache_provider + query_cache_driver: + type: service + id: doctrine.system_cache_provider + result_cache_driver: + type: service + id: doctrine.result_cache_provider + +services: + doctrine.result_cache_provider: + class: Symfony\Component\Cache\DoctrineProvider + public: false + arguments: + - '@doctrine.result_cache_pool' + doctrine.system_cache_provider: + class: Symfony\Component\Cache\DoctrineProvider + public: false + arguments: + - '@doctrine.system_cache_pool' + +framework: + cache: + pools: + doctrine.result_cache_pool: + adapter: cache.app + doctrine.system_cache_pool: + adapter: cache.system diff --git a/tests/Application/config/packages/prod/jms_serializer.yaml b/tests/Application/config/packages/prod/jms_serializer.yaml new file mode 100644 index 000000000..bc97faf1f --- /dev/null +++ b/tests/Application/config/packages/prod/jms_serializer.yaml @@ -0,0 +1,6 @@ +jms_serializer: + visitors: + json: + options: + - JSON_UNESCAPED_SLASHES + - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/app/config/config_prod.yml b/tests/Application/config/packages/prod/monolog.yaml similarity index 85% rename from tests/Application/app/config/config_prod.yml rename to tests/Application/config/packages/prod/monolog.yaml index 11e8e2e06..646121143 100644 --- a/tests/Application/app/config/config_prod.yml +++ b/tests/Application/config/packages/prod/monolog.yaml @@ -1,6 +1,3 @@ -imports: - - { resource: "config.yml" } - monolog: handlers: main: diff --git a/tests/Application/config/packages/routing.yaml b/tests/Application/config/packages/routing.yaml new file mode 100644 index 000000000..368bc7f49 --- /dev/null +++ b/tests/Application/config/packages/routing.yaml @@ -0,0 +1,3 @@ +framework: + router: + strict_requirements: ~ diff --git a/tests/Application/config/packages/security.yaml b/tests/Application/config/packages/security.yaml new file mode 100644 index 000000000..830b03df2 --- /dev/null +++ b/tests/Application/config/packages/security.yaml @@ -0,0 +1,102 @@ +parameters: + sylius.security.admin_regex: "^/admin" + sylius.security.api_regex: "^/api" + sylius.security.shop_regex: "^/(?!admin|api/.*|api$|media/.*)[^/]++" + +security: + providers: + sylius_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + encoders: + Sylius\Component\User\Model\UserInterface: sha512 + firewalls: + admin: + switch_user: true + context: admin + pattern: "%sylius.security.admin_regex%" + provider: sylius_admin_user_provider + form_login: + provider: sylius_admin_user_provider + login_path: sylius_admin_login + check_path: sylius_admin_login_check + failure_path: sylius_admin_login + default_target_path: sylius_admin_dashboard + use_forward: false + use_referer: true + csrf_token_generator: security.csrf.token_manager + csrf_parameter: _csrf_admin_security_token + csrf_token_id: admin_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + path: /admin + name: APP_ADMIN_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_admin_logout + target: sylius_admin_login + anonymous: true + + oauth_token: + pattern: "%sylius.security.api_regex%/oauth/v2/token" + security: false + + api: + pattern: "%sylius.security.api_regex%/.*" + provider: sylius_admin_user_provider + fos_oauth: true + stateless: true + anonymous: true + + shop: + switch_user: { role: ROLE_ALLOWED_TO_SWITCH } + context: shop + pattern: "%sylius.security.shop_regex%" + provider: sylius_shop_user_provider + form_login: + success_handler: sylius.authentication.success_handler + failure_handler: sylius.authentication.failure_handler + provider: sylius_shop_user_provider + login_path: sylius_shop_login + check_path: sylius_shop_login_check + failure_path: sylius_shop_login + default_target_path: sylius_shop_homepage + use_forward: false + use_referer: true + csrf_token_generator: security.csrf.token_manager + csrf_parameter: _csrf_shop_security_token + csrf_token_id: shop_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + name: APP_SHOP_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_shop_logout + target: sylius_shop_login + invalidate_session: false + success_handler: sylius.handler.shop_user_logout + anonymous: true + + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + access_control: + - { path: "%sylius.security.admin_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } + - { path: "%sylius.security.shop_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } + + - { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: "%sylius.security.api_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } + + - { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } + + - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } + - { path: "%sylius.security.api_regex%/.*", role: ROLE_API_ACCESS } + - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } diff --git a/tests/Application/config/packages/security_checker.yaml b/tests/Application/config/packages/security_checker.yaml new file mode 100644 index 000000000..0f9cf00fe --- /dev/null +++ b/tests/Application/config/packages/security_checker.yaml @@ -0,0 +1,9 @@ +services: + SensioLabs\Security\SecurityChecker: + public: false + + SensioLabs\Security\Command\SecurityCheckerCommand: + arguments: ['@SensioLabs\Security\SecurityChecker'] + public: false + tags: + - { name: console.command, command: 'security:check' } diff --git a/tests/Application/config/packages/sonata_core.yaml b/tests/Application/config/packages/sonata_core.yaml new file mode 100644 index 000000000..e9a6e8952 --- /dev/null +++ b/tests/Application/config/packages/sonata_core.yaml @@ -0,0 +1,4 @@ +sonata_core: + form: + mapping: + enabled: false diff --git a/tests/Application/config/packages/staging/monolog.yaml b/tests/Application/config/packages/staging/monolog.yaml new file mode 100644 index 000000000..646121143 --- /dev/null +++ b/tests/Application/config/packages/staging/monolog.yaml @@ -0,0 +1,10 @@ +monolog: + handlers: + main: + type: fingers_crossed + action_level: error + handler: nested + nested: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: debug diff --git a/tests/Application/config/packages/staging/swiftmailer.yaml b/tests/Application/config/packages/staging/swiftmailer.yaml new file mode 100644 index 000000000..f43807805 --- /dev/null +++ b/tests/Application/config/packages/staging/swiftmailer.yaml @@ -0,0 +1,2 @@ +swiftmailer: + disable_delivery: true diff --git a/tests/Application/config/packages/stof_doctrine_extensions.yaml b/tests/Application/config/packages/stof_doctrine_extensions.yaml new file mode 100644 index 000000000..7770f74e1 --- /dev/null +++ b/tests/Application/config/packages/stof_doctrine_extensions.yaml @@ -0,0 +1,4 @@ +# Read the documentation: https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html +# See the official DoctrineExtensions documentation for more details: https://github.com/Atlantic18/DoctrineExtensions/tree/master/doc/ +stof_doctrine_extensions: + default_locale: '%locale%' diff --git a/tests/Application/config/packages/swiftmailer.yaml b/tests/Application/config/packages/swiftmailer.yaml new file mode 100644 index 000000000..3bab0d32f --- /dev/null +++ b/tests/Application/config/packages/swiftmailer.yaml @@ -0,0 +1,2 @@ +swiftmailer: + url: '%env(MAILER_URL)%' diff --git a/tests/Application/config/packages/test/framework.yaml b/tests/Application/config/packages/test/framework.yaml new file mode 100644 index 000000000..76d7e5e11 --- /dev/null +++ b/tests/Application/config/packages/test/framework.yaml @@ -0,0 +1,4 @@ +framework: + test: ~ + session: + storage_id: session.storage.mock_file diff --git a/tests/Application/config/packages/test/monolog.yaml b/tests/Application/config/packages/test/monolog.yaml new file mode 100644 index 000000000..7e2b9e3aa --- /dev/null +++ b/tests/Application/config/packages/test/monolog.yaml @@ -0,0 +1,6 @@ +monolog: + handlers: + main: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: error diff --git a/tests/Application/config/packages/test/swiftmailer.yaml b/tests/Application/config/packages/test/swiftmailer.yaml new file mode 100644 index 000000000..c438f4b25 --- /dev/null +++ b/tests/Application/config/packages/test/swiftmailer.yaml @@ -0,0 +1,6 @@ +swiftmailer: + disable_delivery: true + logging: true + spool: + type: file + path: "%kernel.cache_dir%/spool" diff --git a/tests/Application/config/packages/test/sylius_theme.yaml b/tests/Application/config/packages/test/sylius_theme.yaml new file mode 100644 index 000000000..4d34199f5 --- /dev/null +++ b/tests/Application/config/packages/test/sylius_theme.yaml @@ -0,0 +1,3 @@ +sylius_theme: + sources: + test: ~ diff --git a/tests/Application/config/packages/test/web_profiler.yaml b/tests/Application/config/packages/test/web_profiler.yaml new file mode 100644 index 000000000..03752de21 --- /dev/null +++ b/tests/Application/config/packages/test/web_profiler.yaml @@ -0,0 +1,6 @@ +web_profiler: + toolbar: false + intercept_redirects: false + +framework: + profiler: { collect: false } diff --git a/tests/Application/config/packages/test_cached/doctrine.yaml b/tests/Application/config/packages/test_cached/doctrine.yaml new file mode 100644 index 000000000..49528606d --- /dev/null +++ b/tests/Application/config/packages/test_cached/doctrine.yaml @@ -0,0 +1,16 @@ +doctrine: + orm: + entity_managers: + default: + result_cache_driver: + type: memcached + host: localhost + port: 11211 + query_cache_driver: + type: memcached + host: localhost + port: 11211 + metadata_cache_driver: + type: memcached + host: localhost + port: 11211 diff --git a/tests/Application/config/packages/test_cached/fos_rest.yaml b/tests/Application/config/packages/test_cached/fos_rest.yaml new file mode 100644 index 000000000..2b4189da0 --- /dev/null +++ b/tests/Application/config/packages/test_cached/fos_rest.yaml @@ -0,0 +1,3 @@ +fos_rest: + exception: + debug: true diff --git a/tests/Application/config/packages/test_cached/framework.yaml b/tests/Application/config/packages/test_cached/framework.yaml new file mode 100644 index 000000000..76d7e5e11 --- /dev/null +++ b/tests/Application/config/packages/test_cached/framework.yaml @@ -0,0 +1,4 @@ +framework: + test: ~ + session: + storage_id: session.storage.mock_file diff --git a/tests/Application/config/packages/test_cached/monolog.yaml b/tests/Application/config/packages/test_cached/monolog.yaml new file mode 100644 index 000000000..7e2b9e3aa --- /dev/null +++ b/tests/Application/config/packages/test_cached/monolog.yaml @@ -0,0 +1,6 @@ +monolog: + handlers: + main: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: error diff --git a/tests/Application/config/packages/test_cached/swiftmailer.yaml b/tests/Application/config/packages/test_cached/swiftmailer.yaml new file mode 100644 index 000000000..c438f4b25 --- /dev/null +++ b/tests/Application/config/packages/test_cached/swiftmailer.yaml @@ -0,0 +1,6 @@ +swiftmailer: + disable_delivery: true + logging: true + spool: + type: file + path: "%kernel.cache_dir%/spool" diff --git a/tests/Application/config/packages/test_cached/sylius_channel.yaml b/tests/Application/config/packages/test_cached/sylius_channel.yaml new file mode 100644 index 000000000..bab83ef25 --- /dev/null +++ b/tests/Application/config/packages/test_cached/sylius_channel.yaml @@ -0,0 +1,2 @@ +sylius_channel: + debug: true diff --git a/tests/Application/config/packages/test_cached/sylius_theme.yaml b/tests/Application/config/packages/test_cached/sylius_theme.yaml new file mode 100644 index 000000000..4d34199f5 --- /dev/null +++ b/tests/Application/config/packages/test_cached/sylius_theme.yaml @@ -0,0 +1,3 @@ +sylius_theme: + sources: + test: ~ diff --git a/tests/Application/config/packages/test_cached/twig.yaml b/tests/Application/config/packages/test_cached/twig.yaml new file mode 100644 index 000000000..8c6e0b401 --- /dev/null +++ b/tests/Application/config/packages/test_cached/twig.yaml @@ -0,0 +1,2 @@ +twig: + strict_variables: true diff --git a/tests/Application/config/packages/translation.yaml b/tests/Application/config/packages/translation.yaml new file mode 100644 index 000000000..1f4f96646 --- /dev/null +++ b/tests/Application/config/packages/translation.yaml @@ -0,0 +1,8 @@ +framework: + default_locale: '%locale%' + translator: + paths: + - '%kernel.project_dir%/translations' + fallbacks: + - '%locale%' + - 'en' diff --git a/tests/Application/config/packages/twig.yaml b/tests/Application/config/packages/twig.yaml new file mode 100644 index 000000000..3b315dcc1 --- /dev/null +++ b/tests/Application/config/packages/twig.yaml @@ -0,0 +1,4 @@ +twig: + paths: ['%kernel.project_dir%/templates'] + debug: '%kernel.debug%' + strict_variables: '%kernel.debug%' diff --git a/tests/Application/config/packages/twig_extensions.yaml b/tests/Application/config/packages/twig_extensions.yaml new file mode 100644 index 000000000..0881cc958 --- /dev/null +++ b/tests/Application/config/packages/twig_extensions.yaml @@ -0,0 +1,11 @@ +services: + _defaults: + public: false + autowire: true + autoconfigure: true + + # Uncomment any lines below to activate that Twig extension + #Twig\Extensions\ArrayExtension: ~ + #Twig\Extensions\DateExtension: ~ + #Twig\Extensions\IntlExtension: ~ + #Twig\Extensions\TextExtension: ~ diff --git a/tests/Application/config/packages/validator.yaml b/tests/Application/config/packages/validator.yaml new file mode 100644 index 000000000..61807db62 --- /dev/null +++ b/tests/Application/config/packages/validator.yaml @@ -0,0 +1,3 @@ +framework: + validation: + enable_annotations: true diff --git a/tests/Application/app/config/routing.yml b/tests/Application/config/routes.yaml similarity index 59% rename from tests/Application/app/config/routing.yml rename to tests/Application/config/routes.yaml index 049e71706..8b55c329c 100644 --- a/tests/Application/app/config/routing.yml +++ b/tests/Application/config/routes.yaml @@ -1,14 +1,9 @@ -sylius: - resource: "../../../../vendor/sylius/sylius/app/config/routing.yml" - -# Put your own routes here - -acme_sylius_example_plugin_shop: +acme_sylius_example_shop: resource: "@AcmeSyliusExamplePlugin/Resources/config/shop_routing.yml" prefix: /{_locale} requirements: _locale: ^[a-z]{2}(?:_[A-Z]{2})?$ -acme_sylius_example_plugin_admin: +acme_sylius_example_admin: resource: "@AcmeSyliusExamplePlugin/Resources/config/admin_routing.yml" prefix: /admin diff --git a/tests/Application/config/routes/dev/twig.yaml b/tests/Application/config/routes/dev/twig.yaml new file mode 100644 index 000000000..f4ee83960 --- /dev/null +++ b/tests/Application/config/routes/dev/twig.yaml @@ -0,0 +1,3 @@ +_errors: + resource: '@TwigBundle/Resources/config/routing/errors.xml' + prefix: /_error diff --git a/tests/Application/config/routes/dev/web_profiler.yaml b/tests/Application/config/routes/dev/web_profiler.yaml new file mode 100644 index 000000000..3e79dc212 --- /dev/null +++ b/tests/Application/config/routes/dev/web_profiler.yaml @@ -0,0 +1,7 @@ +_wdt: + resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml" + prefix: /_wdt + +_profiler: + resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml" + prefix: /_profiler diff --git a/tests/Application/config/routes/liip_imagine.yaml b/tests/Application/config/routes/liip_imagine.yaml new file mode 100644 index 000000000..201cbd5d4 --- /dev/null +++ b/tests/Application/config/routes/liip_imagine.yaml @@ -0,0 +1,2 @@ +_liip_imagine: + resource: "@LiipImagineBundle/Resources/config/routing.yaml" diff --git a/tests/Application/config/routes/sylius_admin.yaml b/tests/Application/config/routes/sylius_admin.yaml new file mode 100644 index 000000000..1ba48d6cf --- /dev/null +++ b/tests/Application/config/routes/sylius_admin.yaml @@ -0,0 +1,3 @@ +sylius_admin: + resource: "@SyliusAdminBundle/Resources/config/routing.yml" + prefix: /admin diff --git a/tests/Application/config/routes/sylius_admin_api.yaml b/tests/Application/config/routes/sylius_admin_api.yaml new file mode 100644 index 000000000..80aed457e --- /dev/null +++ b/tests/Application/config/routes/sylius_admin_api.yaml @@ -0,0 +1,3 @@ +sylius_admin_api: + resource: "@SyliusAdminApiBundle/Resources/config/routing.yml" + prefix: /api diff --git a/tests/Application/config/routes/sylius_shop.yaml b/tests/Application/config/routes/sylius_shop.yaml new file mode 100644 index 000000000..8818568b6 --- /dev/null +++ b/tests/Application/config/routes/sylius_shop.yaml @@ -0,0 +1,14 @@ +sylius_shop: + resource: "@SyliusShopBundle/Resources/config/routing.yml" + prefix: /{_locale} + requirements: + _locale: ^[a-z]{2}(?:_[A-Z]{2})?$ + +sylius_shop_payum: + resource: "@SyliusShopBundle/Resources/config/routing/payum.yml" + +sylius_shop_default_locale: + path: / + methods: [GET] + defaults: + _controller: sylius.controller.shop.locale_switch:switchAction diff --git a/tests/Application/config/services.yaml b/tests/Application/config/services.yaml new file mode 100644 index 000000000..615506eb5 --- /dev/null +++ b/tests/Application/config/services.yaml @@ -0,0 +1,4 @@ +# Put parameters here that don't need to change on each machine where the app is deployed +# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration +parameters: + locale: en_US diff --git a/tests/Application/gulpfile.babel.js b/tests/Application/gulpfile.babel.js index 6b2b13779..5920316f8 100644 --- a/tests/Application/gulpfile.babel.js +++ b/tests/Application/gulpfile.babel.js @@ -5,7 +5,7 @@ import yargs from 'yargs'; const { argv } = yargs .options({ rootPath: { - description: ' path to web assets directory', + description: ' path to public assets directory', type: 'string', requiresArg: true, required: false, @@ -20,7 +20,7 @@ const { argv } = yargs const config = [ '--rootPath', - argv.rootPath || '../../../../../../../tests/Application/web/assets', + argv.rootPath || '../../../../../../../tests/Application/public/assets', '--nodeModulesPath', argv.nodeModulesPath || '../../../../../../../tests/Application/node_modules', ]; diff --git a/tests/Application/public/.htaccess b/tests/Application/public/.htaccess new file mode 100644 index 000000000..99ed00df8 --- /dev/null +++ b/tests/Application/public/.htaccess @@ -0,0 +1,25 @@ +DirectoryIndex app.php + + + RewriteEngine On + + RewriteCond %{HTTP:Authorization} ^(.*) + RewriteRule .* - [e=HTTP_AUTHORIZATION:%1] + + RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ + RewriteRule ^(.*) - [E=BASE:%1] + + RewriteCond %{ENV:REDIRECT_STATUS} ^$ + RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] + + RewriteCond %{REQUEST_FILENAME} -f + RewriteRule .? - [L] + + RewriteRule .? %{ENV:BASE}/index.php [L] + + + + + RedirectMatch 302 ^/$ /index.php/ + + diff --git a/tests/Application/public/favicon.ico b/tests/Application/public/favicon.ico new file mode 100644 index 000000000..592f7a8e4 Binary files /dev/null and b/tests/Application/public/favicon.ico differ diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php new file mode 100644 index 000000000..c836084ac --- /dev/null +++ b/tests/Application/public/index.php @@ -0,0 +1,41 @@ +load(__DIR__.'/../.env'); +} + +$env = $_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? 'dev'; +$debug = (bool) ($_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? ('prod' !== $env)); + +if ($debug) { + umask(0000); + + Debug::enable(); +} + +if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) { + Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); +} + +if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) { + Request::setTrustedHosts(explode(',', $trustedHosts)); +} + +$kernel = new Kernel($env, $debug); +$request = Request::createFromGlobals(); +$response = $kernel->handle($request); +$response->send(); +$kernel->terminate($request, $response); diff --git a/tests/Application/public/robots.txt b/tests/Application/public/robots.txt new file mode 100644 index 000000000..214e41196 --- /dev/null +++ b/tests/Application/public/robots.txt @@ -0,0 +1,4 @@ +# www.robotstxt.org/ +# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449 + +User-agent: * diff --git a/etc/build/.gitkeep b/tests/Application/templates/.gitignore similarity index 100% rename from etc/build/.gitkeep rename to tests/Application/templates/.gitignore diff --git a/tests/Application/var/.gitkeep b/tests/Application/translations/.gitignore similarity index 100% rename from tests/Application/var/.gitkeep rename to tests/Application/translations/.gitignore diff --git a/tests/Application/web/assets/.gitkeep b/tests/Application/var/.gitignore similarity index 100% rename from tests/Application/web/assets/.gitkeep rename to tests/Application/var/.gitignore diff --git a/tests/Application/web/app.php b/tests/Application/web/app.php deleted file mode 100644 index e037b29d7..000000000 --- a/tests/Application/web/app.php +++ /dev/null @@ -1,16 +0,0 @@ -handle($request); -$response->send(); - -$kernel->terminate($request, $response); diff --git a/tests/Application/web/app_dev.php b/tests/Application/web/app_dev.php deleted file mode 100644 index 5679cff3b..000000000 --- a/tests/Application/web/app_dev.php +++ /dev/null @@ -1,19 +0,0 @@ -handle($request); -$response->send(); - -$kernel->terminate($request, $response); diff --git a/tests/Application/web/app_test.php b/tests/Application/web/app_test.php deleted file mode 100644 index a124614c6..000000000 --- a/tests/Application/web/app_test.php +++ /dev/null @@ -1,19 +0,0 @@ -handle($request); -$response->send(); - -$kernel->terminate($request, $response); diff --git a/tests/Application/web/bundles/.gitkeep b/tests/Application/web/bundles/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/Application/web/media/image/.gitkeep b/tests/Application/web/media/image/.gitkeep deleted file mode 100644 index e69de29bb..000000000