Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 15 additions & 24 deletions .github/workflows/sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ jobs:
matrix:
php:
- 8.2
- 8.4
sylius:
- 2.1.0
- 2.0.0
symfony:
- 6.4
- 7.3
node:
- 18.x
- 20.x
env:
APP_ENV: test
package-name: payplug/sylius-payplug-plugin
Expand All @@ -43,9 +46,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: '${{ matrix.node }}'
-
name: 'Wkhtmltopdf - Install'
run: "sudo apt-get update\nsudo apt-get install xvfb libfontconfig wkhtmltopdf\nprintf '#!/bin/bash\\nxvfb-run -a --server-args=\"-screen 0, 1024x768x24\" /usr/bin/wkhtmltopdf -q $*' | sudo tee /usr/bin/wkhtmltopdf.sh\nsudo chmod a+x /usr/bin/wkhtmltopdf.sh\nsudo ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf\n"
-
uses: actions/checkout@v3
-
Expand Down Expand Up @@ -80,41 +80,32 @@ jobs:
restore-keys: "node-${{ matrix.node }}-yarn-\n"
-
name: 'Install Sylius-Standard and Plugin'
run: 'make install -e SYLIUS_VERSION=${{ matrix.sylius }} SYMFONY_VERSION=${{ matrix.symfony }} PHP_VERSION=${{ matrix.php }}'
-
name: 'Output PHP version for Symfony CLI'
working-directory: ./tests/Application
run: 'php -v | head -n 1 | awk ''{ print $2 }'' > .php-version'
run: 'make install -e SYLIUS_VERSION=${{ matrix.sylius }} SYMFONY_VERSION=${{ matrix.symfony }}'
-
name: 'Install certificates'
working-directory: ./tests/Application
run: 'symfony server:ca:install'
-
name: 'Run Chrome headless'
working-directory: ./tests/Application
run: 'google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server=''direct://'' --proxy-bypass-list=''*'' https://127.0.0.1 > /dev/null 2>&1 &'
-
name: 'Run webserver'
working-directory: ./tests/Application
run: 'symfony server:start --port=8080 --dir=public --daemon'
run: 'symfony server:start --port=8080 --daemon'
id: end-of-setup-sylius
-
name: 'Doctrine Schema Validate - Run'
working-directory: ./tests/Application
run: 'php bin/console doctrine:schema:validate --skip-sync'
run: 'vendor/bin/console doctrine:schema:validate --skip-sync'
-
name: 'Run PHPUnit'
run: 'make phpunit'
if: 'always() && steps.end-of-setup-sylius.outcome == ''success'''
-
name: 'Configure Behat'
run: 'make behat-configure'
if: 'always() && steps.end-of-setup-sylius.outcome == ''success'''
-
name: 'Run behat'
working-directory: ./tests/Application
run: 'vendor/bin/behat --strict --no-interaction -f progress || vendor/bin/behat --strict -vvv --no-interaction --rerun'
if: 'always() && steps.end-of-setup-sylius.outcome == ''success'''
# -
# name: 'Configure Behat'
# run: 'make behat-configure'
# if: 'always() && steps.end-of-setup-sylius.outcome == ''success'''
# -
# name: 'Run behat'
# run: 'vendor/bin/behat --strict --no-interaction -f progress || vendor/bin/behat --strict -vvv --no-interaction --rerun'
# if: 'always() && steps.end-of-setup-sylius.outcome == ''success'''
-
uses: actions/upload-artifact@v4
if: failure()
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@

/.idea
*.map

/tests/TestApplication/.env.local
/tests/TestApplication/.env.*.local
/var/
81 changes: 16 additions & 65 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,91 +1,42 @@
.DEFAULT_GOAL := help
SHELL=/bin/bash
COMPOSER_ROOT=composer
TEST_DIRECTORY=tests/Application
CONSOLE=cd tests/Application && php bin/console -e test
COMPOSER=cd tests/Application && composer
YARN=cd tests/Application && yarn

SYLIUS_VERSION=1.12.0
SYMFONY_VERSION=6.1
PHP_VERSION=8.1
TEST_DIRECTORY=tests/TestApplication
CONSOLE=vendor/bin/console
COMPOSER=composer
SYLIUS_VERSION=2.1.0
SYMFONY_VERSION=6.4
PLUGIN_NAME=payplug/sylius-payplug-plugin

###
### DEVELOPMENT
### ¯¯¯¯¯¯¯¯¯¯¯

install: sylius ## Install Plugin on Sylius [SYLIUS_VERSION=1.12.0] [SYMFONY_VERSION=6.1] [PHP_VERSION=8.1]
install: sylius ## Install all dependencies with [SYLIUS_VERSION=2.1.0] [SYMFONY_VERSION=6.4]
.PHONY: install

reset: ## Remove dependencies
ifneq ("$(wildcard tests/Application/bin/console)","")
${CONSOLE} doctrine:database:drop --force --if-exists || true
endif
rm -rf tests/Application
rm -rf vendor
.PHONY: reset

phpunit: phpunit-configure phpunit-run ## Run PHPUnit
phpunit: ## Run PHPUnit tests
./vendor/bin/phpunit
.PHONY: phpunit

###
### OTHER
### ¯¯¯¯¯¯

sylius: sylius-standard install-plugin install-sylius
sylius: install-sylius
.PHONY: sylius

sylius-standard:
ifeq ($(shell [[ $(SYLIUS_VERSION) == *dev ]] && echo true ),true)
${COMPOSER_ROOT} create-project sylius/sylius-standard:${SYLIUS_VERSION} ${TEST_DIRECTORY} --no-install --no-scripts
else
${COMPOSER_ROOT} create-project sylius/sylius-standard ${TEST_DIRECTORY} "~${SYLIUS_VERSION}" --no-install --no-scripts
endif
${COMPOSER} config allow-plugins true
ifeq ($(shell [[ $(SYLIUS_VERSION) == *dev ]] && echo true ),true)
${COMPOSER} require sylius/sylius:"${SYLIUS_VERSION}"
else
${COMPOSER} require sylius/sylius:"~${SYLIUS_VERSION}"
endif

install-plugin:
${COMPOSER} config repositories.plugin '{"type": "path", "url": "../../"}'
${COMPOSER} config extra.symfony.allow-contrib true
${COMPOSER} config minimum-stability "dev"
${COMPOSER} config prefer-stable true
${COMPOSER} require "${PLUGIN_NAME}:*" --prefer-source --no-scripts

cp -r install/Application tests
sed -i "4a \ \ \ \ form_themes: ['form/form_gateway_config_row.html.twig']" ${TEST_DIRECTORY}/config/packages/twig.yaml
mkdir -p ${TEST_DIRECTORY}/templates/form/
cp -R src/Resources/views/form/* ${TEST_DIRECTORY}/templates/form/

# As of sylius/refund-plugin 1.2 the folder does not exist anymore
ifneq ($(PHP_VERSION), 8)
mkdir -p ${TEST_DIRECTORY}/templates/bundles/SyliusAdminBundle/
cp -R src/Resources/views/SyliusAdminBundle/* ${TEST_DIRECTORY}/templates/bundles/SyliusAdminBundle/
endif

install-sylius:
#${CONSOLE} sylius:install -n -s default
${CONSOLE} doctrine:database:create -n
${CONSOLE} messenger:setup-transports -n
${CONSOLE} doctrine:migration:migrate -n
${CONSOLE} sylius:fixture:load -n
${YARN} install
${YARN} build
${YARN} gulp
${CONSOLE} translation:extract en PayPlugSyliusPayPlugPlugin --dump-messages
${CONSOLE} translation:extract fr PayPlugSyliusPayPlugPlugin --dump-messages

${CONSOLE} cache:clear
@echo "Installing Sylius ${SYLIUS_VERSION} using TestApplication"
${COMPOSER} config extra.symfony.require "^${SYMFONY_VERSION}"
${COMPOSER} install
${COMPOSER} require --dev sylius/test-application:"^${SYLIUS_VERSION}@alpha" -n -W # TODO: Remove alpha when stable
${COMPOSER} test-application:install

phpunit-configure:
cp phpunit.xml.dist ${TEST_DIRECTORY}/phpunit.xml
echo -e "\nMOCK_SERVER_HOST=localhost\nMOCK_SERVER_PORT=8987\n" >> ${TEST_DIRECTORY}/.env.test.local

phpunit-run:
cd ${TEST_DIRECTORY} && ./vendor/bin/phpunit

behat-configure: ## Configure Behat
(cd ${TEST_DIRECTORY} && cp behat.yml.dist behat.yml)
Expand All @@ -101,7 +52,7 @@ grumphp:
vendor/bin/grumphp run

help: SHELL=/bin/bash
help: ## Dislay this help
help: ## Display this help
@IFS=$$'\n'; for line in `grep -h -E '^[a-zA-Z_#-]+:?.*?##.*$$' $(MAKEFILE_LIST)`; do if [ "$${line:0:2}" = "##" ]; then \
echo $$line | awk 'BEGIN {FS = "## "}; {printf "\033[33m %s\033[0m\n", $$2}'; else \
echo $$line | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m%s\n", $$1, $$2}'; fi; \
Expand Down
2 changes: 2 additions & 0 deletions assets/admin/entrypoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Mandatory by test application
// whereas it's useless
41 changes: 41 additions & 0 deletions assets/controllers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"controllers": {
"@payplug/sylius-payplug-plugin": {
"oney-popin": {
"enabled": true,
"fetch": "lazy",
"autoimport": {
"@payplug/sylius-payplug-plugin/shop/dist/oney_common/index.css": true,
"@payplug/sylius-payplug-plugin/shop/dist/oney_popin/index.css": true
}
},
"integrated-payment": {
"enabled": true,
"fetch": "lazy",
"autoimport": {
"@payplug/sylius-payplug-plugin/shop/dist/payment/integrated.css": true
}
},
"oney-payment": {
"enabled": true,
"fetch": "lazy"
},
"payment-logo": {
"enabled": true,
"fetch": "lazy"
},
"checkout-select-payment": {
"enabled": true,
"fetch": "lazy",
"autoimport": {
"@payplug/sylius-payplug-plugin/shop/dist/payment/index.css": true
}
},
"apple-pay": {
"enabled": true,
"fetch": "lazy"
}
}
},
"entrypoints": []
}
2 changes: 2 additions & 0 deletions assets/shop/entrypoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Mandatory by test application
// whereas it's useless
50 changes: 38 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
"description": "PayPlug payment plugin for Sylius applications.",
"license": "MIT",
"require": {
"php": "^8.0",
"php": "^8.2",
"ext-json": "*",
"giggsey/libphonenumber-for-php": "^8.12",
"payplug/payplug-php": "^3.1",
"php-http/message-factory": "^1.1",
"sylius/refund-plugin": "^2.0",
"sylius/sylius": "^2.0",
"symfony/asset": "^6.0|^7.0",
"symfony/lock": "^6.0|^7.0",
"symfony/validator": "^6.0|^7.0"
"symfony/asset": "^6.4|| ^7.2",
"symfony/lock": "^6.4|| ^7.2",
"symfony/validator": "^6.4|| ^7.2"
},
"require-dev": {
"behat/behat": "3.20.0",
Expand All @@ -34,8 +34,7 @@
"friends-of-behat/suite-settings-extension": "1.1.0",
"friends-of-behat/symfony-extension": "2.6.0",
"friends-of-behat/variadic-extension": "1.6.0",
"friendsoftwig/twigcs": "6.4.0",
"j13k/yaml-lint": "1.1.6",
"friendsoftwig/twigcs": "6.5.0",
"lakion/mink-debug-extension": "2.0.0",
"mockery/mockery": "1.6.12",
"php-parallel-lint/php-parallel-lint": "1.4.0",
Expand All @@ -49,17 +48,23 @@
"phpunit/phpunit": "9.6.22",
"rector/rector": "2.0.4",
"sylius-labs/coding-standard": "4.4.0",
"symfony/browser-kit": "7.2.4",
"symfony/debug-bundle": "^7.2.0",
"symfony/dotenv": "7.2.0",
"symfony/web-profiler-bundle": "7.2.4",
"sylius/test-application": "^2.1.0@alpha",
"symfony/apache-pack": "*",
"symfony/browser-kit": "^6.4|| ^7.2",
"symfony/debug-bundle": "^6.4|| ^7.2",
"symfony/dotenv": "^6.4|| ^7.2",
"symfony/web-profiler-bundle": "^6.4|| ^7.2",
"webmozart/assert": "^1.8"
},
"prefer-stable": true,
"autoload": {
"psr-4": {
"PayPlug\\SyliusPayPlugPlugin\\": "src/",
"Tests\\PayPlug\\SyliusPayPlugPlugin\\": "tests/"
"PayPlug\\SyliusPayPlugPlugin\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\PayPlug\\SyliusPayPlugPlugin\\": ["tests/", "tests/TestApplication/src/"]
}
},
"config": {
Expand All @@ -70,6 +75,7 @@
"phpro/grumphp": true,
"phpstan/extension-installer": true,
"symfony/flex": true,
"symfony/runtime": true,
"symfony/thanks": true
}
},
Expand All @@ -84,6 +90,26 @@
"@phpmd",
"@phpstan",
"@phpunit"
],
"test-application:install": [
"vendor/bin/console doctrine:database:drop --force --if-exists -n",
"vendor/bin/console doctrine:database:create -n",
"vendor/bin/console doctrine:migration:migrate -n",
"vendor/bin/console sylius:payment:generate-key -n",
"vendor/bin/console sylius:fixtures:load -n",
"yarn --cwd vendor/sylius/test-application install",
"yarn --cwd vendor/sylius/test-application build",
"vendor/bin/console assets:install --symlink -n"
],
"test-application:front": [
"yarn --cwd vendor/sylius/test-application install --force",
"yarn --cwd vendor/sylius/test-application build"
]
},
"extra": {
"public-dir": "vendor/sylius/test-application/public",
"symfony": {
"require": "^6.4"
}
}
}
3 changes: 0 additions & 3 deletions install/Application/.gitignore

This file was deleted.

30 changes: 0 additions & 30 deletions install/Application/config/packages/payplug.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions install/Application/config/packages/sylius_payplug.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions install/Application/config/packages/sylius_refund.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions install/Application/config/routes/sylius_refund.yaml

This file was deleted.

Loading
Loading