From e26a92ae028931e7abd89892cb386c5cbff5c72c Mon Sep 17 00:00:00 2001 From: VANCLOOSTER Mickael Date: Thu, 24 Oct 2019 09:22:26 +0200 Subject: [PATCH] [TASK] Initial commit --- .github/CODEOWNERS | 1 + .gitignore | 11 ++ .travis.yml | 77 +++++++++++++ README.md | 88 +++++++++++++++ UPGRADE-1.3.md | 28 +++++ UPGRADE-1.4.md | 86 ++++++++++++++ behat.yml.dist | 47 ++++++++ composer.json | 58 ++++++++++ easy-coding-standard.yml | 2 + etc/build/.gitignore | 0 node_modules | 1 + phpspec.yml.dist | 4 + phpstan.neon | 17 +++ phpunit.xml.dist | 20 ++++ .../AcmeSyliusExampleExtension.php | 24 ++++ src/DependencyInjection/Configuration.php | 27 +++++ src/IpanemaSyliusSeoPagePlugin.php | 13 +++ src/Resources/config/admin_routing.yml | 1 + src/Resources/config/services.xml | 0 tests/Application/.babelrc | 15 +++ tests/Application/.env | 23 ++++ tests/Application/.env.test | 3 + tests/Application/.eslintrc.js | 20 ++++ tests/Application/.gitignore | 22 ++++ tests/Application/Kernel.php | 106 ++++++++++++++++++ tests/Application/bin/console | 38 +++++++ tests/Application/composer.json | 5 + tests/Application/config/bootstrap.php | 21 ++++ tests/Application/config/bundles.php | 60 ++++++++++ .../Application/config/packages/_sylius.yaml | 14 +++ .../config/packages/dev/framework.yaml | 2 + .../config/packages/dev/jms_serializer.yaml | 7 ++ .../config/packages/dev/monolog.yaml | 9 ++ .../config/packages/dev/routing.yaml | 3 + .../config/packages/dev/swiftmailer.yaml | 2 + .../config/packages/dev/web_profiler.yaml | 3 + .../Application/config/packages/doctrine.yaml | 14 +++ .../config/packages/doctrine_migrations.yaml | 5 + .../Application/config/packages/fos_rest.yaml | 11 ++ .../config/packages/framework.yaml | 7 ++ .../config/packages/jms_serializer.yaml | 4 + .../config/packages/liip_imagine.yaml | 6 + .../config/packages/prod/doctrine.yaml | 31 +++++ .../config/packages/prod/jms_serializer.yaml | 6 + .../config/packages/prod/monolog.yaml | 10 ++ .../Application/config/packages/routing.yaml | 3 + .../Application/config/packages/security.yaml | 102 +++++++++++++++++ .../config/packages/security_checker.yaml | 9 ++ .../config/packages/sonata_core.yaml | 4 + .../config/packages/staging/monolog.yaml | 10 ++ .../config/packages/staging/swiftmailer.yaml | 2 + .../packages/stof_doctrine_extensions.yaml | 4 + .../config/packages/swiftmailer.yaml | 2 + .../config/packages/test/framework.yaml | 4 + .../config/packages/test/monolog.yaml | 6 + .../config/packages/test/swiftmailer.yaml | 6 + .../config/packages/test/sylius_theme.yaml | 3 + .../config/packages/test/web_profiler.yaml | 6 + .../config/packages/test_cached/doctrine.yaml | 16 +++ .../config/packages/test_cached/fos_rest.yaml | 3 + .../packages/test_cached/framework.yaml | 4 + .../config/packages/test_cached/monolog.yaml | 6 + .../packages/test_cached/swiftmailer.yaml | 6 + .../packages/test_cached/sylius_channel.yaml | 2 + .../packages/test_cached/sylius_theme.yaml | 3 + .../config/packages/test_cached/twig.yaml | 2 + .../config/packages/translation.yaml | 8 ++ tests/Application/config/packages/twig.yaml | 4 + .../config/packages/twig_extensions.yaml | 11 ++ .../config/packages/validator.yaml | 3 + tests/Application/config/routes.yaml | 9 ++ tests/Application/config/routes/dev/twig.yaml | 3 + .../config/routes/dev/web_profiler.yaml | 7 ++ .../config/routes/liip_imagine.yaml | 2 + .../config/routes/sylius_admin.yaml | 3 + .../config/routes/sylius_admin_api.yaml | 3 + .../config/routes/sylius_shop.yaml | 14 +++ tests/Application/config/services.yaml | 4 + tests/Application/config/services_test.yaml | 3 + tests/Application/gulpfile.babel.js | 60 ++++++++++ tests/Application/package.json | 53 +++++++++ tests/Application/public/.htaccess | 25 +++++ tests/Application/public/favicon.ico | Bin 0 -> 32038 bytes tests/Application/public/index.php | 27 +++++ .../Application/public/media/image/.gitignore | 0 tests/Application/public/robots.txt | 4 + tests/Application/templates/.gitignore | 0 tests/Application/translations/.gitignore | 0 .../Behat/Context/Ui/Shop/WelcomeContext.php | 80 +++++++++++++ tests/Behat/Page/Shop/DynamicWelcomePage.php | 44 ++++++++ tests/Behat/Page/Shop/StaticWelcomePage.php | 36 ++++++ .../Behat/Page/Shop/WelcomePageInterface.php | 15 +++ tests/Behat/Resources/services.xml | 16 +++ tests/Behat/Resources/suites.yml | 10 ++ 94 files changed, 1599 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 README.md create mode 100644 UPGRADE-1.3.md create mode 100644 UPGRADE-1.4.md create mode 100644 behat.yml.dist create mode 100644 composer.json create mode 100644 easy-coding-standard.yml create mode 100644 etc/build/.gitignore create mode 120000 node_modules create mode 100644 phpspec.yml.dist create mode 100644 phpstan.neon create mode 100644 phpunit.xml.dist create mode 100644 src/DependencyInjection/AcmeSyliusExampleExtension.php create mode 100644 src/DependencyInjection/Configuration.php create mode 100644 src/IpanemaSyliusSeoPagePlugin.php create mode 100644 src/Resources/config/admin_routing.yml create mode 100644 src/Resources/config/services.xml create mode 100644 tests/Application/.babelrc create mode 100644 tests/Application/.env create mode 100644 tests/Application/.env.test create mode 100644 tests/Application/.eslintrc.js create mode 100644 tests/Application/.gitignore create mode 100644 tests/Application/Kernel.php create mode 100755 tests/Application/bin/console create mode 100644 tests/Application/composer.json create mode 100644 tests/Application/config/bootstrap.php create mode 100644 tests/Application/config/bundles.php create mode 100644 tests/Application/config/packages/_sylius.yaml create mode 100644 tests/Application/config/packages/dev/framework.yaml create mode 100644 tests/Application/config/packages/dev/jms_serializer.yaml create mode 100644 tests/Application/config/packages/dev/monolog.yaml create mode 100644 tests/Application/config/packages/dev/routing.yaml create mode 100644 tests/Application/config/packages/dev/swiftmailer.yaml create mode 100644 tests/Application/config/packages/dev/web_profiler.yaml create mode 100644 tests/Application/config/packages/doctrine.yaml create mode 100644 tests/Application/config/packages/doctrine_migrations.yaml create mode 100644 tests/Application/config/packages/fos_rest.yaml create mode 100644 tests/Application/config/packages/framework.yaml create mode 100644 tests/Application/config/packages/jms_serializer.yaml create mode 100644 tests/Application/config/packages/liip_imagine.yaml create mode 100644 tests/Application/config/packages/prod/doctrine.yaml create mode 100644 tests/Application/config/packages/prod/jms_serializer.yaml create mode 100644 tests/Application/config/packages/prod/monolog.yaml create mode 100644 tests/Application/config/packages/routing.yaml create mode 100644 tests/Application/config/packages/security.yaml create mode 100644 tests/Application/config/packages/security_checker.yaml create mode 100644 tests/Application/config/packages/sonata_core.yaml create mode 100644 tests/Application/config/packages/staging/monolog.yaml create mode 100644 tests/Application/config/packages/staging/swiftmailer.yaml create mode 100644 tests/Application/config/packages/stof_doctrine_extensions.yaml create mode 100644 tests/Application/config/packages/swiftmailer.yaml create mode 100644 tests/Application/config/packages/test/framework.yaml create mode 100644 tests/Application/config/packages/test/monolog.yaml create mode 100644 tests/Application/config/packages/test/swiftmailer.yaml create mode 100644 tests/Application/config/packages/test/sylius_theme.yaml create mode 100644 tests/Application/config/packages/test/web_profiler.yaml create mode 100644 tests/Application/config/packages/test_cached/doctrine.yaml create mode 100644 tests/Application/config/packages/test_cached/fos_rest.yaml create mode 100644 tests/Application/config/packages/test_cached/framework.yaml create mode 100644 tests/Application/config/packages/test_cached/monolog.yaml create mode 100644 tests/Application/config/packages/test_cached/swiftmailer.yaml create mode 100644 tests/Application/config/packages/test_cached/sylius_channel.yaml create mode 100644 tests/Application/config/packages/test_cached/sylius_theme.yaml create mode 100644 tests/Application/config/packages/test_cached/twig.yaml create mode 100644 tests/Application/config/packages/translation.yaml create mode 100644 tests/Application/config/packages/twig.yaml create mode 100644 tests/Application/config/packages/twig_extensions.yaml create mode 100644 tests/Application/config/packages/validator.yaml create mode 100644 tests/Application/config/routes.yaml create mode 100644 tests/Application/config/routes/dev/twig.yaml create mode 100644 tests/Application/config/routes/dev/web_profiler.yaml create mode 100644 tests/Application/config/routes/liip_imagine.yaml create mode 100644 tests/Application/config/routes/sylius_admin.yaml create mode 100644 tests/Application/config/routes/sylius_admin_api.yaml create mode 100644 tests/Application/config/routes/sylius_shop.yaml create mode 100644 tests/Application/config/services.yaml create mode 100644 tests/Application/config/services_test.yaml create mode 100644 tests/Application/gulpfile.babel.js create mode 100644 tests/Application/package.json create mode 100644 tests/Application/public/.htaccess create mode 100644 tests/Application/public/favicon.ico create mode 100644 tests/Application/public/index.php create mode 100644 tests/Application/public/media/image/.gitignore create mode 100644 tests/Application/public/robots.txt create mode 100644 tests/Application/templates/.gitignore create mode 100644 tests/Application/translations/.gitignore create mode 100644 tests/Behat/Context/Ui/Shop/WelcomeContext.php create mode 100644 tests/Behat/Page/Shop/DynamicWelcomePage.php create mode 100644 tests/Behat/Page/Shop/StaticWelcomePage.php create mode 100644 tests/Behat/Page/Shop/WelcomePageInterface.php create mode 100644 tests/Behat/Resources/services.xml create mode 100644 tests/Behat/Resources/suites.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..92faea2 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @Sylius/core-team diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..07229a6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +/vendor/ +/node_modules/ +/composer.lock + +/etc/build/* +!/etc/build/.gitignore + +/tests/Application/yarn.lock + +/behat.yml +/phpspec.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8983354 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,77 @@ +language: php + +dist: trusty + +sudo: false + +php: + - '7.2' + - '7.3' + +cache: + yarn: true + directories: + - ~/.composer/cache/files + - $SYLIUS_CACHE_DIR + +env: + global: + - APP_ENV=test + - SYLIUS_CACHE_DIR=$HOME/.sylius-cache + - SYLIUS_BUILD_DIR=etc/build + +before_install: + - phpenv config-rm xdebug.ini + - echo "memory_limit=4096M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + - mkdir -p "${SYLIUS_CACHE_DIR}" + +install: + - composer install --no-interaction --prefer-dist + - (cd tests/Application && yarn install) + +before_script: + - (cd tests/Application && bin/console doctrine:database:create -vvv) + - (cd tests/Application && bin/console doctrine:schema:create -vvv) + - (cd tests/Application && bin/console assets:install public -vvv) + - (cd tests/Application && bin/console cache:warmup -vvv) + - (cd tests/Application && yarn build) + + # Configure display + - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1680x1050x16 + - export DISPLAY=:99 + + # Download and configure ChromeDriver + - | + if [ ! -f $SYLIUS_CACHE_DIR/chromedriver ] || [ "$($SYLIUS_CACHE_DIR/chromedriver --version | grep -c 2.34)" = "0" ]; then + curl http://chromedriver.storage.googleapis.com/2.34/chromedriver_linux64.zip > chromedriver.zip + unzip chromedriver.zip + chmod +x chromedriver + mv chromedriver $SYLIUS_CACHE_DIR + fi + + # Run ChromeDriver + - $SYLIUS_CACHE_DIR/chromedriver > /dev/null 2>&1 & + + # Download and configure Selenium + - | + if [ ! -f $SYLIUS_CACHE_DIR/selenium.jar ] || [ "$(java -jar $SYLIUS_CACHE_DIR/selenium.jar --version | grep -c 3.4.0)" = "0" ]; then + curl http://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar > selenium.jar + mv selenium.jar $SYLIUS_CACHE_DIR + fi + + # Run Selenium + - 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 --quiet > /dev/null 2>&1 &) + +script: + - composer validate --strict + - vendor/bin/phpstan analyse -c phpstan.neon -l max src/ + + - 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/README.md b/README.md new file mode 100644 index 0000000..e80ae4b --- /dev/null +++ b/README.md @@ -0,0 +1,88 @@ +

+ + + +

+ +

Plugin Skeleton

+ +

Skeleton for starting Sylius plugins.

+ +## Installation + +1. Run `composer create-project sylius/plugin-skeleton ProjectName`. + +2. From the plugin skeleton root directory, run the following commands: + + ```bash + $ (cd tests/Application && yarn install) + $ (cd tests/Application && yarn build) + $ (cd tests/Application && bin/console assets:install public -e test) + + $ (cd tests/Application && bin/console doctrine:database:create -e test) + $ (cd tests/Application && bin/console doctrine:schema:create -e test) + ``` + +To be able to setup a plugin's database, remember to configure you database credentials in `tests/Application/.env` and `tests/Application/.env.test`. + +## Usage + +### Running plugin tests + + - PHPUnit + + ```bash + $ vendor/bin/phpunit + ``` + + - PHPSpec + + ```bash + $ vendor/bin/phpspec run + ``` + + - Behat (non-JS scenarios) + + ```bash + $ vendor/bin/behat --tags="~@javascript" + ``` + + - Behat (JS scenarios) + + 1. Download [Chromedriver](https://sites.google.com/a/chromium.org/chromedriver/) + + 2. Download [Selenium Standalone Server](https://www.seleniumhq.org/download/). + + 2. Run Selenium server with previously downloaded Chromedriver: + + ```bash + $ java -Dwebdriver.chrome.driver=chromedriver -jar selenium-server-standalone.jar + ``` + + 3. Run test application's webserver on `localhost:8080`: + + ```bash + $ (cd tests/Application && bin/console server:run localhost:8080 -d public -e test) + ``` + + 4. Run Behat: + + ```bash + $ vendor/bin/behat --tags="@javascript" + ``` + +### Opening Sylius with your plugin + +- Using `test` environment: + + ```bash + $ (cd tests/Application && bin/console sylius:fixtures:load -e test) + $ (cd tests/Application && bin/console server:run -d public -e test) + ``` + +- Using `dev` environment: + + ```bash + $ (cd tests/Application && bin/console sylius:fixtures:load -e dev) + $ (cd tests/Application && bin/console server:run -d public -e dev) + ``` diff --git a/UPGRADE-1.3.md b/UPGRADE-1.3.md new file mode 100644 index 0000000..9fd4141 --- /dev/null +++ b/UPGRADE-1.3.md @@ -0,0 +1,28 @@ +# UPGRADE FROM `v1.2.X` TO `v1.3.0` + +## Application + +* Run `composer require sylius/sylius:~1.3.0 --no-update` + +* Add the following code in your `behat.yml(.dist)` file: + + ```yaml + default: + extensions: + FriendsOfBehat\SymfonyExtension: + env_file: ~ + ``` + +* Incorporate changes from the following files into plugin's test application: + + * [`tests/Application/package.json`](https://github.com/Sylius/PluginSkeleton/blob/1.3/tests/Application/package.json) ([see diff](https://github.com/Sylius/PluginSkeleton/pull/134/files#diff-726e1353c14df7d91379c0dea6b30eef)) + * [`tests/Application/.babelrc`](https://github.com/Sylius/PluginSkeleton/blob/1.3/tests/Application/.babelrc) ([see diff](https://github.com/Sylius/PluginSkeleton/pull/134/files#diff-a2527d9d8ad55460b2272274762c9386)) + * [`tests/Application/.eslintrc.js`](https://github.com/Sylius/PluginSkeleton/blob/1.3/tests/Application/.eslintrc.js) ([see diff](https://github.com/Sylius/PluginSkeleton/pull/134/files#diff-396c8c412b119deaa7dd84ae28ae04ca)) + +* Update PHP and JS dependencies by running `composer update` and `(cd tests/Application && yarn upgrade)` + +* Clear cache by running `(cd tests/Application && bin/console cache:clear)` + +* Install assets by `(cd tests/Application && bin/console assets:install web)` and `(cd tests/Application && yarn build)` + +* optionally, remove the build for PHP 7.1. in `.travis.yml` diff --git a/UPGRADE-1.4.md b/UPGRADE-1.4.md new file mode 100644 index 0000000..dc84cad --- /dev/null +++ b/UPGRADE-1.4.md @@ -0,0 +1,86 @@ +# UPGRADE FROM `v1.3.X` TO `v1.4.0` + +First step is upgrading Sylius with composer + +- `composer require sylius/sylius:~1.4.0` + +### Test application database + +#### Migrations + +If you provide migrations with your plugin, take a look at following changes: + +* Change base `AbstractMigration` namespace to `Doctrine\Migrations\AbstractMigration` +* Add `: void` return types to both `up` and `down` functions + +#### Schema update + +If you don't use migrations, just run `(cd tests/Application && bin/console doctrine:schema:update --force)` to update the test application's database schema. + +### Dotenv + +* `composer require symfony/dotenv:^4.2 --dev` +* Follow [Symfony dotenv update guide](https://symfony.com/doc/current/configuration/dot-env-changes.html) to incorporate required changes in `.env` files structure. Remember - they should be done on `tests/Application/` level! Optionally, you can take a look at [corresponding PR](https://github.com/Sylius/PluginSkeleton/pull/156/) introducing these changes in **PluginSkeleton** (this PR also includes changes with Behat - see below) + +Don't forget to clear the cache (`tests/Application/bin/console cache:clear`) to be 100% everything is loaded properly. + +--- + +### Behat + +If you're using Behat and want to be up-to-date with our configuration + +* Update required extensions with `composer require friends-of-behat/symfony-extension:^2.0 friends-of-behat/page-object-extension:^0.3 --dev` +* Remove extensions that are not needed yet with `composer remove friends-of-behat/context-service-extension friends-of-behat/cross-container-extension friends-of-behat/service-container-extension --dev` +* Update your `behat.yml` - look at the diff [here](https://github.com/Sylius/Sylius-Standard/pull/322/files#diff-7bde54db60a6e933518d8b61b929edce) +* Add `SymfonyExtensionBundle` to your `tests/Application/config/bundles.php`: + ```php + return [ + //... + FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true], + ]; + ``` +* If you use our Travis CI configuration, follow [these changes](https://github.com/Sylius/PluginSkeleton/pull/156/files#diff-354f30a63fb0907d4ad57269548329e3) introduced in `.travis.yml` file +* Create `tests/Application/config/services_test.yaml` file with the following code and add these your own Behat services as well: + ```yaml + imports: + - { resource: "../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" } + ``` +* Remove all `__symfony__` prefixes in your Behat services +* Remove all `` tags from your Behat services +* Make your Behat services public by default with `` +* Change `contexts_services ` in your suite definitions to `contexts` +* Take a look at [SymfonyExtension UPGRADE guide](https://github.com/FriendsOfBehat/SymfonyExtension/blob/master/UPGRADE-2.0.md) if you have any more problems + +### Phpstan + +* Fix the container XML path parameter in the `phpstan.neon` file as done [here](https://github.com/Sylius/PluginSkeleton/commit/37fa614dbbcf8eb31b89eaf202b4bd4d89a5c7b3) + +# UPGRADE FROM `v1.2.X` TO `v1.4.0` + +Firstly, check out the [PluginSkeleton 1.3 upgrade guide](https://github.com/Sylius/PluginSkeleton/blob/1.4/UPGRADE-1.3.md) to update Sylius version step by step. +To upgrade to Sylius 1.4 follow instructions from [the previous section](https://github.com/Sylius/PluginSkeleton/blob/1.4/UPGRADE-1.4.md#upgrade-from-v13x-to-v140) with following changes: + +### Doctrine migrations + +* Change namespaces of copied migrations to `Sylius\Migrations` + +### Dotenv + +* These changes are not required, but can be done as well, if you've changed application directory structure in `1.2.x` to `1.3` update + +### Behat + +* Add `\FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle()` to your bundles lists in `tests/Application/AppKernel.php` (preferably only in `test` environment) +* Import Sylius Behat services in `tests/Application/config/config_test.yml` and your own Behat services as well: + ```yaml + imports: + - { resource: "../../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" } + ``` +* Specify test application's kernel path in `behat.yml`: + ```yaml + FriendsOfBehat\SymfonyExtension: + kernel: + class: AppKernel + path: tests/Application/app/AppKernel.php + ``` diff --git a/behat.yml.dist b/behat.yml.dist new file mode 100644 index 0000000..05d3376 --- /dev/null +++ b/behat.yml.dist @@ -0,0 +1,47 @@ +imports: + - vendor/sylius/sylius/src/Sylius/Behat/Resources/config/suites.yml + - tests/Behat/Resources/suites.yml + +default: + extensions: + Lakion\Behat\MinkDebugExtension: + directory: etc/build + clean_start: false + screenshot: true + + Behat\MinkExtension: + files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/" + base_url: "http://localhost:8080/" + default_session: symfony + javascript_session: chrome + sessions: + symfony: + symfony: ~ + chrome: + selenium2: + browser: chrome + capabilities: + browserName: chrome + browser: chrome + version: "" + marionette: null # https://github.com/Behat/MinkExtension/pull/311 + chrome: + switches: + - "start-fullscreen" + - "start-maximized" + - "no-sandbox" + firefox: + selenium2: + browser: firefox + show_auto: false + + FriendsOfBehat\SymfonyExtension: + bootstrap: tests/Application/config/bootstrap.php + kernel: + class: Tests\Acme\SyliusExamplePlugin\Application\Kernel + + FriendsOfBehat\VariadicExtension: ~ + + FriendsOfBehat\SuiteSettingsExtension: + paths: + - "features" diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..7a142a3 --- /dev/null +++ b/composer.json @@ -0,0 +1,58 @@ +{ + "name": "ipanema/sylius-seo-page-plugin", + "type": "sylius-plugin", + "keywords": ["sylius", "sylius-plugin", "seo"], + "description": "Seo for page for sylius", + "license": "MIT", + "require": { + "php": "^7.2", + "sylius/sylius": "^1.4" + }, + "require-dev": { + "behat/behat": "^3.4", + "behat/mink": "^1.7@dev", + "behat/mink-browserkit-driver": "^1.3", + "behat/mink-extension": "^2.2", + "behat/mink-selenium2-driver": "^1.3", + "friends-of-behat/page-object-extension": "^0.3", + "friends-of-behat/suite-settings-extension": "^1.0", + "friends-of-behat/symfony-extension": "^2.0", + "friends-of-behat/variadic-extension": "^1.1", + "lakion/mink-debug-extension": "^1.2.3", + "phpspec/phpspec": "^5.0", + "phpstan/phpstan-doctrine": "^0.10", + "phpstan/phpstan-shim": "^0.10", + "phpstan/phpstan-webmozart-assert": "^0.10", + "phpunit/phpunit": "^6.5", + "sensiolabs/security-checker": "^5.0", + "sylius-labs/coding-standard": "^2.0", + "symfony/browser-kit": "^3.4|^4.1", + "symfony/debug-bundle": "^3.4|^4.1", + "symfony/dotenv": "^4.2", + "symfony/intl": "^3.4|^4.1", + "symfony/web-profiler-bundle": "^3.4|^4.1", + "symfony/web-server-bundle": "^3.4|^4.1" + }, + "conflict": { + "symfony/symfony": "4.1.8", + "symfony/browser-kit": "4.1.8", + "symfony/dependency-injection": "4.1.8", + "symfony/dom-crawler": "4.1.8", + "symfony/routing": "4.1.8" + }, + "prefer-stable": true, + "autoload": { + "psr-4": { + "Ipanema\\SyliusSeoPagePlugin\\": "src/", + "Tests\\Ipanema\\SyliusSeoPagePlugin\\": "tests/" + } + }, + "autoload-dev": { + "classmap": ["tests/Application/Kernel.php"] + }, + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + } +} diff --git a/easy-coding-standard.yml b/easy-coding-standard.yml new file mode 100644 index 0000000..2403599 --- /dev/null +++ b/easy-coding-standard.yml @@ -0,0 +1,2 @@ +imports: + - { resource: 'vendor/sylius-labs/coding-standard/easy-coding-standard.yml' } diff --git a/etc/build/.gitignore b/etc/build/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/node_modules b/node_modules new file mode 120000 index 0000000..9270531 --- /dev/null +++ b/node_modules @@ -0,0 +1 @@ +tests/Application/node_modules \ No newline at end of file diff --git a/phpspec.yml.dist b/phpspec.yml.dist new file mode 100644 index 0000000..1ce17db --- /dev/null +++ b/phpspec.yml.dist @@ -0,0 +1,4 @@ +suites: + main: + namespace: Ipanema\SyliusSeoPagePlugin + psr4_prefix: Ipanema\SyliusSeoPagePlugin diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..ea8e49e --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,17 @@ +includes: + - vendor/phpstan/phpstan-doctrine/extension.neon + - vendor/phpstan/phpstan-webmozart-assert/extension.neon + +parameters: + reportUnmatchedIgnoredErrors: false + + excludes_analyse: + # Makes PHPStan crash + - 'src/DependencyInjection/Configuration.php' + + # Test dependencies + - 'tests/Application/app/**.php' + - 'tests/Application/src/**.php' + + ignoreErrors: + - '/Parameter #1 $configuration of method Symfony\Component\DependencyInjection\Extension\Extension::processConfiguration() expects Symfony\Component\Config\Definition\ConfigurationInterface, Symfony\Component\Config\Definition\ConfigurationInterface|null given./' diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..3762a13 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,20 @@ + + + + + + tests + + + + + + + + + + diff --git a/src/DependencyInjection/AcmeSyliusExampleExtension.php b/src/DependencyInjection/AcmeSyliusExampleExtension.php new file mode 100644 index 0000000..2ba1b0c --- /dev/null +++ b/src/DependencyInjection/AcmeSyliusExampleExtension.php @@ -0,0 +1,24 @@ +processConfiguration($this->getConfiguration([], $container), $config); + $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); + + $loader->load('services.xml'); + } +} diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php new file mode 100644 index 0000000..2896381 --- /dev/null +++ b/src/DependencyInjection/Configuration.php @@ -0,0 +1,27 @@ +getRootNode(); + } else { + // BC layer for symfony/config 4.1 and older + $rootNode = $treeBuilder->root('ipanema_sylius_seo_page_plugin'); + } + + return $treeBuilder; + } +} diff --git a/src/IpanemaSyliusSeoPagePlugin.php b/src/IpanemaSyliusSeoPagePlugin.php new file mode 100644 index 0000000..95a5eea --- /dev/null +++ b/src/IpanemaSyliusSeoPagePlugin.php @@ -0,0 +1,13 @@ + 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.test b/tests/Application/.env.test new file mode 100644 index 0000000..c0ee239 --- /dev/null +++ b/tests/Application/.env.test @@ -0,0 +1,3 @@ +APP_SECRET='ch4mb3r0f5ecr3ts' + +KERNEL_CLASS='Tests\Acme\SyliusExamplePlugin\Application\Kernel' diff --git a/tests/Application/.eslintrc.js b/tests/Application/.eslintrc.js new file mode 100644 index 0000000..92c4cee --- /dev/null +++ b/tests/Application/.eslintrc.js @@ -0,0 +1,20 @@ +module.exports = { + extends: 'airbnb-base', + env: { + node: true, + }, + rules: { + 'object-shorthand': ['error', 'always', { + avoidQuotes: true, + avoidExplicitReturnArrows: true, + }], + 'function-paren-newline': ['error', 'consistent'], + 'max-len': ['warn', 120, 2, { + ignoreUrls: true, + ignoreComments: false, + ignoreRegExpLiterals: true, + ignoreStrings: true, + ignoreTemplateLiterals: true, + }], + }, +}; diff --git a/tests/Application/.gitignore b/tests/Application/.gitignore new file mode 100644 index 0000000..8ad1225 --- /dev/null +++ b/tests/Application/.gitignore @@ -0,0 +1,22 @@ +/public/assets +/public/css +/public/js +/public/media/* +!/public/media/image/ +/public/media/image/* +!/public/media/image/.gitignore + +/node_modules + +###> symfony/framework-bundle ### +/.env.*.local +/.env.local +/.env.local.php +/public/bundles +/var/ +/vendor/ +###< symfony/framework-bundle ### + +###> symfony/web-server-bundle ### +/.web-server-pid +###< symfony/web-server-bundle ### diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php new file mode 100644 index 0000000..91c592d --- /dev/null +++ b/tests/Application/Kernel.php @@ -0,0 +1,106 @@ +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(); + } + } + } + + 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(); + } + + protected function getContainerLoader(ContainerInterface $container): LoaderInterface + { + /** @var ContainerBuilder $container */ + Assert::isInstanceOf($container, ContainerBuilder::class); + + $locator = new FileLocator($this, $this->getRootDir() . '/Resources'); + $resolver = new LoaderResolver(array( + new XmlFileLoader($container, $locator), + new YamlFileLoader($container, $locator), + new IniFileLoader($container, $locator), + new PhpFileLoader($container, $locator), + new GlobFileLoader($container, $locator), + new DirectoryLoader($container, $locator), + new ClosureLoader($container), + )); + + return new DelegatingLoader($resolver); + } + + private function isTestEnvironment(): bool + { + return 0 === strpos($this->getEnvironment(), 'test'); + } +} diff --git a/tests/Application/bin/console b/tests/Application/bin/console new file mode 100755 index 0000000..bf889e9 --- /dev/null +++ b/tests/Application/bin/console @@ -0,0 +1,38 @@ +#!/usr/bin/env php +getParameterOption(['--env', '-e'], null, true)) { + putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); +} + +if ($input->hasParameterOption('--no-debug', true)) { + putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); +} + +require dirname(__DIR__).'/config/bootstrap.php'; + +if ($_SERVER['APP_DEBUG']) { + umask(0000); + + if (class_exists(Debug::class)) { + Debug::enable(); + } +} + +$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_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 0000000..326735f --- /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/bootstrap.php b/tests/Application/config/bootstrap.php new file mode 100644 index 0000000..6bb0207 --- /dev/null +++ b/tests/Application/config/bootstrap.php @@ -0,0 +1,21 @@ +=1.2) +if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) { + $_SERVER += $env; + $_ENV += $env; +} elseif (!class_exists(Dotenv::class)) { + throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); +} else { + // load all the .env files + (new Dotenv())->loadEnv(dirname(__DIR__).'/.env'); +} + +$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; +$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; +$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php new file mode 100644 index 0000000..689934c --- /dev/null +++ b/tests/Application/config/bundles.php @@ -0,0 +1,60 @@ + ['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], + FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['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 0000000..89674ac --- /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 0000000..4b116de --- /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 0000000..353e460 --- /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 0000000..da2b092 --- /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 0000000..4116679 --- /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 0000000..f438078 --- /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 0000000..1f1cb2b --- /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 0000000..f51ba5a --- /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 0000000..c0a1202 --- /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 0000000..a72eef7 --- /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 0000000..e74ed81 --- /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 0000000..64dd8d1 --- /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 0000000..bb2e7ce --- /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 0000000..2f16f0f --- /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 0000000..bc97faf --- /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/config/packages/prod/monolog.yaml b/tests/Application/config/packages/prod/monolog.yaml new file mode 100644 index 0000000..6461211 --- /dev/null +++ b/tests/Application/config/packages/prod/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/routing.yaml b/tests/Application/config/packages/routing.yaml new file mode 100644 index 0000000..368bc7f --- /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 0000000..830b03d --- /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 0000000..0f9cf00 --- /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 0000000..e9a6e89 --- /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 0000000..6461211 --- /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 0000000..f438078 --- /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 0000000..7770f74 --- /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 0000000..3bab0d3 --- /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 0000000..76d7e5e --- /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 0000000..7e2b9e3 --- /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 0000000..c438f4b --- /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 0000000..4d34199 --- /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 0000000..03752de --- /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 0000000..4952860 --- /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 0000000..2b4189d --- /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 0000000..76d7e5e --- /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 0000000..7e2b9e3 --- /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 0000000..c438f4b --- /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 0000000..bab83ef --- /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 0000000..4d34199 --- /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 0000000..8c6e0b4 --- /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 0000000..1f4f966 --- /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 0000000..3b315dc --- /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 0000000..0881cc9 --- /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 0000000..61807db --- /dev/null +++ b/tests/Application/config/packages/validator.yaml @@ -0,0 +1,3 @@ +framework: + validation: + enable_annotations: true diff --git a/tests/Application/config/routes.yaml b/tests/Application/config/routes.yaml new file mode 100644 index 0000000..8b55c32 --- /dev/null +++ b/tests/Application/config/routes.yaml @@ -0,0 +1,9 @@ +acme_sylius_example_shop: + resource: "@AcmeSyliusExamplePlugin/Resources/config/shop_routing.yml" + prefix: /{_locale} + requirements: + _locale: ^[a-z]{2}(?:_[A-Z]{2})?$ + +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 0000000..f4ee839 --- /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 0000000..3e79dc2 --- /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 0000000..201cbd5 --- /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 0000000..1ba48d6 --- /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 0000000..80aed45 --- /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 0000000..8818568 --- /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 0000000..615506e --- /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/config/services_test.yaml b/tests/Application/config/services_test.yaml new file mode 100644 index 0000000..d9b02e3 --- /dev/null +++ b/tests/Application/config/services_test.yaml @@ -0,0 +1,3 @@ +imports: + - { resource: "../../Behat/Resources/services.xml" } + - { resource: "../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" } diff --git a/tests/Application/gulpfile.babel.js b/tests/Application/gulpfile.babel.js new file mode 100644 index 0000000..5920316 --- /dev/null +++ b/tests/Application/gulpfile.babel.js @@ -0,0 +1,60 @@ +import chug from 'gulp-chug'; +import gulp from 'gulp'; +import yargs from 'yargs'; + +const { argv } = yargs + .options({ + rootPath: { + description: ' path to public assets directory', + type: 'string', + requiresArg: true, + required: false, + }, + nodeModulesPath: { + description: ' path to node_modules directory', + type: 'string', + requiresArg: true, + required: false, + }, + }); + +const config = [ + '--rootPath', + argv.rootPath || '../../../../../../../tests/Application/public/assets', + '--nodeModulesPath', + argv.nodeModulesPath || '../../../../../../../tests/Application/node_modules', +]; + +export const buildAdmin = function buildAdmin() { + return gulp.src('../../vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/gulpfile.babel.js', { read: false }) + .pipe(chug({ args: config, tasks: 'build' })); +}; +buildAdmin.description = 'Build admin assets.'; + +export const watchAdmin = function watchAdmin() { + return gulp.src('../../vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/gulpfile.babel.js', { read: false }) + .pipe(chug({ args: config, tasks: 'watch' })); +}; +watchAdmin.description = 'Watch admin asset sources and rebuild on changes.'; + +export const buildShop = function buildShop() { + return gulp.src('../../vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/gulpfile.babel.js', { read: false }) + .pipe(chug({ args: config, tasks: 'build' })); +}; +buildShop.description = 'Build shop assets.'; + +export const watchShop = function watchShop() { + return gulp.src('../../vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/gulpfile.babel.js', { read: false }) + .pipe(chug({ args: config, tasks: 'watch' })); +}; +watchShop.description = 'Watch shop asset sources and rebuild on changes.'; + +export const build = gulp.parallel(buildAdmin, buildShop); +build.description = 'Build assets.'; + +gulp.task('admin', buildAdmin); +gulp.task('admin-watch', watchAdmin); +gulp.task('shop', buildShop); +gulp.task('shop-watch', watchShop); + +export default build; diff --git a/tests/Application/package.json b/tests/Application/package.json new file mode 100644 index 0000000..14072b2 --- /dev/null +++ b/tests/Application/package.json @@ -0,0 +1,53 @@ +{ + "dependencies": { + "babel-polyfill": "^6.26.0", + "jquery": "^3.2.0", + "lightbox2": "^2.9.0", + "semantic-ui-css": "^2.2.0" + }, + "devDependencies": { + "babel-core": "^6.26.3", + "babel-plugin-external-helpers": "^6.22.0", + "babel-plugin-module-resolver": "^3.1.1", + "babel-plugin-transform-object-rest-spread": "^6.26.0", + "babel-preset-env": "^1.7.0", + "babel-register": "^6.26.0", + "dedent": "^0.7.0", + "eslint": "^4.19.1", + "eslint-config-airbnb-base": "^12.1.0", + "eslint-import-resolver-babel-module": "^4.0.0", + "eslint-plugin-import": "^2.12.0", + "fast-async": "^6.3.7", + "gulp": "^4.0.0", + "gulp-chug": "^0.5", + "gulp-concat": "^2.6.0", + "gulp-debug": "^2.1.2", + "gulp-if": "^2.0.0", + "gulp-livereload": "^3.8.1", + "gulp-order": "^1.1.1", + "gulp-sass": "^4.0.1", + "gulp-sourcemaps": "^1.6.0", + "gulp-uglifycss": "^1.0.5", + "merge-stream": "^1.0.0", + "rollup": "^0.60.7", + "rollup-plugin-babel": "^3.0.4", + "rollup-plugin-commonjs": "^9.1.3", + "rollup-plugin-inject": "^2.0.0", + "rollup-plugin-node-resolve": "^3.3.0", + "rollup-plugin-uglify": "^4.0.0", + "upath": "^1.1.0", + "yargs": "^6.4.0" + }, + "scripts": { + "build": "gulp build", + "gulp": "gulp build", + "lint": "yarn lint:js", + "lint:js": "eslint gulpfile.babel.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Sylius/Sylius.git" + }, + "author": "Paweł Jędrzejewski", + "license": "MIT" +} diff --git a/tests/Application/public/.htaccess b/tests/Application/public/.htaccess new file mode 100644 index 0000000..99ed00d --- /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 0000000000000000000000000000000000000000..592f7a8e45d5ef6fe2a3c0426b5276e463480ba5 GIT binary patch literal 32038 zcmeHQ4NO#5+NN=dA;z$#F^w_CnoZLsP17~T#Xl;F2&jmH2&jNc5hrj3LAj!gs&t%y8h&WqvL*7f{zp z4)@%9&(C|_bMAZI^S;kHI5@oL@H>a!|K0(=4;>Ev&cR_LiG66eFU9i;Jp0q1M(;mz zaM(HD!NJ|#aR0~k4i5jf%E94}xFtn=i142NFVY|%_s1~Id)y#t`KwdG&99urH=>+# z8zP)V^?RLjYQvl_)rZgFrsdveR0cX9m#)4WFIhPpFIh1ben9+e?fNHI+JYBw^RVwv z$lN49NL(3iI4)hmWHxVPa+I4(*y-8vlO^lIx%tRF$$R#iJCmjKB4H#?9pJ~#N8+dD z-XDYJmo)#0(p5}K_1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al 0 HcmV?d00001 diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php new file mode 100644 index 0000000..2f8f1b1 --- /dev/null +++ b/tests/Application/public/index.php @@ -0,0 +1,27 @@ +handle($request); +$response->send(); +$kernel->terminate($request, $response); diff --git a/tests/Application/public/media/image/.gitignore b/tests/Application/public/media/image/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/tests/Application/public/robots.txt b/tests/Application/public/robots.txt new file mode 100644 index 0000000..214e411 --- /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/tests/Application/templates/.gitignore b/tests/Application/templates/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/tests/Application/translations/.gitignore b/tests/Application/translations/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/tests/Behat/Context/Ui/Shop/WelcomeContext.php b/tests/Behat/Context/Ui/Shop/WelcomeContext.php new file mode 100644 index 0000000..a0d95b0 --- /dev/null +++ b/tests/Behat/Context/Ui/Shop/WelcomeContext.php @@ -0,0 +1,80 @@ +staticWelcomePage = $staticWelcomePage; + $this->dynamicWelcomePage = $dynamicWelcomePage; + } + + /** + * @When a customer with an unknown name visits static welcome page + */ + public function customerWithUnknownNameVisitsStaticWelcomePage(): void + { + $this->staticWelcomePage->open(); + } + + /** + * @When a customer named :name visits static welcome page + */ + public function namedCustomerVisitsStaticWelcomePage(string $name): void + { + $this->staticWelcomePage->open(['name' => $name]); + } + + /** + * @Then they should be statically greeted with :greeting + */ + public function theyShouldBeStaticallyGreetedWithGreeting(string $greeting): void + { + Assert::same($this->staticWelcomePage->getGreeting(), $greeting); + } + + /** + * @When a customer with an unknown name visits dynamic welcome page + */ + public function customerWithUnknownNameVisitsDynamicWelcomePage(): void + { + $this->dynamicWelcomePage->open(); + } + + /** + * @When a customer named :name visits dynamic welcome page + */ + public function namedCustomerVisitsDynamicWelcomePage(string $name): void + { + $this->dynamicWelcomePage->open(['name' => $name]); + } + + /** + * @Then they should be dynamically greeted with :greeting + */ + public function theyShouldBeDynamicallyGreetedWithGreeting(string $greeting): void + { + Assert::same($this->dynamicWelcomePage->getGreeting(), $greeting); + } +} diff --git a/tests/Behat/Page/Shop/DynamicWelcomePage.php b/tests/Behat/Page/Shop/DynamicWelcomePage.php new file mode 100644 index 0000000..08e5f8c --- /dev/null +++ b/tests/Behat/Page/Shop/DynamicWelcomePage.php @@ -0,0 +1,44 @@ +getSession()->getPage()->waitFor(3, function (): string { + $greeting = $this->getElement('greeting')->getText(); + + if ('Loading...' === $greeting) { + return ''; + } + + return $greeting; + }); + } + + /** + * {@inheritdoc} + */ + public function getRouteName(): string + { + return 'acme_sylius_example_dynamic_welcome'; + } + + /** + * {@inheritdoc} + */ + protected function getDefinedElements(): array + { + return array_merge(parent::getDefinedElements(), [ + 'greeting' => '#greeting', + ]); + } +} diff --git a/tests/Behat/Page/Shop/StaticWelcomePage.php b/tests/Behat/Page/Shop/StaticWelcomePage.php new file mode 100644 index 0000000..8f2a96b --- /dev/null +++ b/tests/Behat/Page/Shop/StaticWelcomePage.php @@ -0,0 +1,36 @@ +getElement('greeting')->getText(); + } + + /** + * {@inheritdoc} + */ + public function getRouteName(): string + { + return 'acme_sylius_example_static_welcome'; + } + + /** + * {@inheritdoc} + */ + protected function getDefinedElements(): array + { + return array_merge(parent::getDefinedElements(), [ + 'greeting' => '#greeting', + ]); + } +} diff --git a/tests/Behat/Page/Shop/WelcomePageInterface.php b/tests/Behat/Page/Shop/WelcomePageInterface.php new file mode 100644 index 0000000..7cd873c --- /dev/null +++ b/tests/Behat/Page/Shop/WelcomePageInterface.php @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + + diff --git a/tests/Behat/Resources/suites.yml b/tests/Behat/Resources/suites.yml new file mode 100644 index 0000000..6cfe415 --- /dev/null +++ b/tests/Behat/Resources/suites.yml @@ -0,0 +1,10 @@ +# Put your Behat suites definitions here + +default: + suites: + greeting_customer: + contexts: + - acme_sylius_example.context.ui.shop.welcome + + filters: + tags: "@greeting_customer"