Skip to content

Commit 0fcf077

Browse files
committed
Upgrade for Sylius 2.0
1 parent 5a35c4a commit 0fcf077

File tree

70 files changed

+419
-876
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+419
-876
lines changed

.dockerignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
**/*.log
2+
**/*.md
3+
**/*.php~
4+
**/._*
5+
**/.dockerignore
6+
**/.DS_Store
7+
**/.git/
8+
**/.gitattributes
9+
**/.github
10+
**/.gitignore
11+
**/.gitkeep
12+
**/.gitmodules
13+
**/.idea
14+
**/Dockerfile
15+
**/Thumbs.db
16+
**/docker-compose*.yaml
17+
**/docker-compose*.yml
18+
.editorconfig
19+
.php_cs.cache
20+
.travis.yml
21+
composer.phar
22+
docker/mysql/data/
23+
etc/build/*
24+
node_modules/
25+
var/*
26+
vendor/
27+
public/assets/
28+
public/build/
29+
public/bundles/
30+
public/css/
31+
public/js/
32+
public/media/

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
php: ["8.1", "8.2", "8.3"]
25-
symfony: ["5.4.*", "6.4.*"]
24+
php: ["8.2", "8.3"]
25+
symfony: ["^6.4", "^7.1"]
2626
node: ["20.x"]
2727
mysql: ["8.0"]
2828

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/vendor/
2+
/var/
23
/node_modules/
34
/composer.lock
45

@@ -11,6 +12,7 @@
1112
/behat.yml
1213
/phpspec.yml
1314
/phpunit.xml
15+
/compose.override.yml
1416
.phpunit.result.cache
1517

1618
# Symfony CLI https://symfony.com/doc/current/setup/symfony_server.html#different-php-settings-per-project

Makefile

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
.PHONY: run
2+
3+
DOCKER_COMPOSE ?= docker compose
4+
DOCKER_USER ?= "$(shell id -u):$(shell id -g)"
5+
ENV ?= "dev"
6+
7+
init:
8+
@make -s docker-compose-check
9+
@if [ ! -e compose.override.yml ]; then \
10+
cp compose.override.dist.yml compose.override.yml; \
11+
fi
12+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php composer install --no-interaction --no-scripts --no-plugins
13+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm nodejs
14+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) up -d
15+
16+
run:
17+
@make -s up
18+
19+
debug:
20+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) -f compose.yml -f compose.override.yml -f compose.debug.yml up -d
21+
22+
up:
23+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) up -d
24+
25+
down:
26+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) down
27+
28+
clean:
29+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) down -v
30+
31+
php-shell:
32+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) exec php sh
33+
34+
node-shell:
35+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm -i nodejs sh
36+
37+
node-watch:
38+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm -i nodejs "npm run watch"
39+
40+
docker-compose-check:
41+
@$(DOCKER_COMPOSE) version >/dev/null 2>&1 || (echo "Please install docker compose binary or set DOCKER_COMPOSE=\"docker-compose\" for legacy binary" && exit 1)
42+
@echo "You are using \"$(DOCKER_COMPOSE)\" binary"
43+
@echo "Current version is \"$$($(DOCKER_COMPOSE) version)\""
44+
45+
database-init:
46+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php tests/Application/bin/console doctrine:database:create -n --if-not-exists
47+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php tests/Application/bin/console doctrine:migrations:migrate -n
48+
49+
database-reset:
50+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php tests/Application/bin/console doctrine:database:drop -n --force --if-exists
51+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php tests/Application/bin/console doctrine:database:create -n
52+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php tests/Application/bin/console doctrine:migrations:migrate -n
53+
54+
load-fixtures:
55+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php tests/Application/bin/console sylius:fixtures:load -n
56+
57+
phpstan:
58+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/phpstan analyse -c phpstan.neon
59+
60+
ecs:
61+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/ecs check src
62+
63+
phpunit:
64+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/phpunit
65+
66+
behat:
67+
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/behat
File renamed without changes.

assets/shop/entrypoint.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './js/greetings';

assets/shop/js/greetings.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
setTimeout(function () {
2+
document.getElementById('greeting').innerHTML = document.getElementById('greeting').dataset.greeting;
3+
}, 1000);

behat.yml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ default:
3636
validate_certificate: false
3737
panther:
3838
panther:
39+
options:
40+
webServerDir: '%paths.base%/tests/Application/public'
3941
manager_options:
4042
connection_timeout_in_ms: 5000
4143
request_timeout_in_ms: 120000

bin/create_node_symlink.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
exec(sprintf('mklink /J %s %s 2> NUL', NODE_MODULES_FOLDER_NAME, PATH_TO_NODE_MODULES), $output, $returnCode);
3030
$success = $returnCode === 0;
3131
if (!$success) {
32-
echo '> Failed o create the required symlink' . PHP_EOL;
32+
echo '> Failed o create the required symlink' . PHP_EOL;
3333
exit(2);
3434
}
3535
}

compose.override.dist.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
services:
2+
php:
3+
image: ghcr.io/sylius/sylius-php:8.3-fixuid-xdebug-alpine
4+
user: ${DOCKER_USER:-1000:1000}
5+
depends_on:
6+
mysql:
7+
condition: service_healthy
8+
environment:
9+
# You can move these environment variables to your .env.local file
10+
APP_ENV: ${ENV:-prod}
11+
APP_SECRET: EDITME
12+
DATABASE_URL: "mysql://root@mysql/sylius_%kernel.environment%"
13+
MAILER_DSN: smtp://mailhog:1025
14+
MESSENGER_TRANSPORT_DSN: doctrine://default
15+
SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN: doctrine://default
16+
SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN: doctrine://default?queue_name=main_failed
17+
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN: doctrine://default?queue_name=catalog_promotion_removal
18+
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN: doctrine://default?queue_name=catalog_promotion_removal_failed
19+
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_DSN: sync://
20+
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_FAILED_DSN: sync://
21+
PHP_DATE_TIMEZONE: ${PHP_DATE_TIMEZONE:-UTC}
22+
XDEBUG_MODE: debug
23+
XDEBUG_CONFIG: >-
24+
client_host=host.docker.internal
25+
client_port=9003
26+
# This should correspond to the server declared in PHPStorm `Preferences | Languages & Frameworks | PHP | Servers`
27+
# Then PHPStorm will use the corresponding path mappings
28+
PHP_IDE_CONFIG: serverName=sylius
29+
extra_hosts:
30+
- "host.docker.internal:host-gateway"
31+
volumes:
32+
- .:/srv/sylius:rw,cached
33+
# if you develop on Linux, you may use a bind-mounted host directory instead
34+
# - ./var:/srv/sylius/var:rw
35+
- ./public:/srv/sylius/public:rw,delegated
36+
# if you develop on Linux, you may use a bind-mounted host directory instead
37+
# - ./public/media:/srv/sylius/public/media:rw
38+
- public-media:/srv/sylius/public/media:rw
39+
mysql:
40+
volumes:
41+
- mysql-data:/var/lib/mysql:rw
42+
ports:
43+
- "3306:3306"
44+
nginx:
45+
environment:
46+
WORKING_DIR: /srv/sylius/tests/Application
47+
volumes:
48+
- .:/srv/sylius:ro
49+
# if you develop on Linux, you may use a bind-mounted host directory instead
50+
# - ./public/media:/srv/sylius/public/media:ro
51+
ports:
52+
- "80:80"
53+
nodejs:
54+
image: node:${NODE_VERSION:-20}-alpine
55+
user: ${DOCKER_USER:-1000:1000}
56+
working_dir: /srv/sylius
57+
entrypoint: [ "/bin/sh","-c" ]
58+
command:
59+
- |
60+
cd tests/Application
61+
yarn install
62+
yarn build
63+
volumes:
64+
- .:/srv/sylius:rw,cached
65+
- ./public:/srv/sylius/public:rw,delegated
66+
mailhog:
67+
ports:
68+
- "8025:8025"
69+
70+
volumes:
71+
mysql-data:
72+
public-media:

compose.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
services:
2+
php:
3+
image: ghcr.io/sylius/sylius-php:8.3-alpine
4+
mysql:
5+
image: mysql:8.4
6+
platform: linux/amd64
7+
healthcheck:
8+
test: '/usr/bin/mysql --execute "SHOW databases;"'
9+
timeout: 3s
10+
interval: 1s
11+
retries: 10
12+
environment:
13+
MYSQL_ALLOW_EMPTY_PASSWORD: 1
14+
cap_add:
15+
- SYS_NICE # prevent "mbind: Operation not permitted" errors
16+
nginx:
17+
image: ghcr.io/sylius/sylius-nginx:latest
18+
depends_on:
19+
- php
20+
mailhog:
21+
# do not use in production!
22+
image: mailhog/mailhog:latest

composer.json

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,58 +8,58 @@
88
],
99
"license": "MIT",
1010
"require": {
11-
"php": "^8.0",
11+
"php": "^8.2",
1212
"php-http/message-factory": "^1.1",
13-
"psr/http-factory": "^1.0",
14-
"symfony/webpack-encore-bundle": "^1.15",
15-
"sylius/sylius": "^1.11.2 || ^1.12 || ^1.13",
16-
"webmozart/glob": "^4.3"
13+
"psr/http-factory": "^1.1",
14+
"sylius/sylius": "~2.0.0",
15+
"webmozart/glob": "^4.7"
1716
},
1817
"require-dev": {
19-
"behat/behat": "^3.6.1",
20-
"behat/mink-selenium2-driver": "^1.4",
21-
"dbrekelmans/bdi": "^1.1",
22-
"dmore/behat-chrome-extension": "^1.3",
23-
"dmore/chrome-mink-driver": "^2.7",
24-
"friends-of-behat/mink": "^1.8",
25-
"friends-of-behat/mink-browserkit-driver": "^1.4",
26-
"friends-of-behat/mink-debug-extension": "^2.0.0",
27-
"friends-of-behat/mink-extension": "^2.4",
28-
"friends-of-behat/page-object-extension": "^0.3",
29-
"friends-of-behat/suite-settings-extension": "^1.0",
30-
"friends-of-behat/symfony-extension": "^2.1",
31-
"friends-of-behat/variadic-extension": "^1.3",
32-
"mikey179/vfsstream": "^1.6",
33-
"phpspec/phpspec": "^7.2",
34-
"phpstan/extension-installer": "^1.0",
35-
"phpstan/phpstan": "^1.8.1",
18+
"behat/behat": "^3.19",
19+
"behat/mink-selenium2-driver": "^1.7",
20+
"dbrekelmans/bdi": "^1.4",
21+
"dmore/behat-chrome-extension": "^1.4",
22+
"dmore/chrome-mink-driver": "^2.9.3",
23+
"friends-of-behat/mink": "^1.11",
24+
"friends-of-behat/mink-browserkit-driver": "^1.6.2",
25+
"friends-of-behat/mink-debug-extension": "^2.1.0",
26+
"friends-of-behat/mink-extension": "^2.7.5",
27+
"friends-of-behat/page-object-extension": "^0.3.2",
28+
"friends-of-behat/suite-settings-extension": "^1.1",
29+
"friends-of-behat/symfony-extension": "^2.6",
30+
"friends-of-behat/variadic-extension": "^1.6",
31+
"mikey179/vfsstream": "^1.6.12",
32+
"phpspec/phpspec": "^7.6",
33+
"phpstan/extension-installer": "^1.4.3",
34+
"phpstan/phpstan": "^1.12.25",
3635
"phpstan/phpstan-doctrine": "1.3.69",
37-
"phpstan/phpstan-strict-rules": "^1.3.0",
38-
"phpstan/phpstan-webmozart-assert": "^1.2.0",
39-
"phpunit/phpunit": "^10.5",
40-
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
41-
"robertfausk/behat-panther-extension": "^1.1",
42-
"sylius-labs/coding-standard": "^4.2",
36+
"phpstan/phpstan-strict-rules": "^1.6.2",
37+
"phpstan/phpstan-webmozart-assert": "^1.2.11",
38+
"phpunit/phpunit": "^10.5.46",
39+
"polishsymfonycommunity/symfony-mocker-container": "^1.0.8",
40+
"robertfausk/behat-panther-extension": "^1.2",
41+
"sylius-labs/coding-standard": "^4.4",
4342
"sylius-labs/suite-tags-extension": "^0.2",
44-
"symfony/browser-kit": "^5.4 || ^6.4",
45-
"symfony/debug-bundle": "^5.4 || ^6.4",
46-
"symfony/dotenv": "^5.4 || ^6.4",
47-
"symfony/flex": "^2.4",
48-
"symfony/intl": "^5.4 || ^6.4",
49-
"symfony/web-profiler-bundle": "^5.4 || ^6.4",
50-
"vimeo/psalm": "^5.24"
43+
"symfony/browser-kit": "^6.4 || ^7.1",
44+
"symfony/debug-bundle": "^6.4 || ^7.1",
45+
"symfony/dotenv": "^6.4 || ^7.1",
46+
"symfony/flex": "^2.5",
47+
"symfony/intl": "^6.4 || ^7.1",
48+
"symfony/web-profiler-bundle": "^6.4 || ^7.1",
49+
"vimeo/psalm": "^5.26.1"
5150
},
5251
"config": {
5352
"sort-packages": true,
5453
"allow-plugins": {
5554
"dealerdirect/phpcodesniffer-composer-installer": false,
55+
"php-http/discovery": false,
5656
"phpstan/extension-installer": true,
5757
"symfony/flex": true
5858
}
5959
},
6060
"extra": {
6161
"branch-alias": {
62-
"dev-master": "1.13-dev"
62+
"dev-master": "1.2.0-dev"
6363
}
6464
},
6565
"autoload": {
@@ -89,7 +89,7 @@
8989
"auto-scripts": {
9090
"cache:clear": "symfony-cmd",
9191
"assets:install %PUBLIC_DIR%": "symfony-cmd",
92-
"security-checker security:check": "script"
92+
"COMPOSER_AUDIT_ABANDONED=ignore composer audit": "script"
9393
}
9494
}
9595
}

ecs.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
66
use Symplify\EasyCodingStandard\Config\ECSConfig;
7-
use Symplify\EasyCodingStandard\ValueObject\Option;
87

98
return static function (ECSConfig $ecsConfig): void {
109
$ecsConfig->import('vendor/sylius-labs/coding-standard/ecs.php');

package.json

Lines changed: 0 additions & 22 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)