Skip to content
Open
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
40 changes: 21 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ jobs:
fail-fast: false
matrix:
php: ["8.1", "8.2", "8.3"]
symfony: ["^5.4.21", "^6.4"]
sylius: ["~1.13.0", "~1.14.0"]
symfony: ["^6.4"]
sylius: ["~1.14.0"]
node: ["^20.x"]
mysql: ["8.0"]

exclude:
- sylius: "~1.14.0"
symfony: ^5.4

env:
APP_ENV: test
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"
Expand Down Expand Up @@ -66,11 +62,6 @@ jobs:
- name: Install certificates
run: symfony server:ca:install

- name: Run Chrome Headless
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='*' http://127.0.0.1 > /dev/null 2>&1 &

- name: Run webserver
run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon)

- name: Get Composer cache directory
id: composer-cache
Expand All @@ -83,12 +74,14 @@ jobs:
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-composer-

- name: Restrict Symfony version
if: matrix.symfony != ''
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10"
composer config extra.symfony.require "${{ matrix.symfony }}"

- name: Restrict Sylius version
if: matrix.sylius != ''
run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction
Expand All @@ -107,28 +100,31 @@ jobs:
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-yarn-

- name: Install JS dependencies
run: (cd tests/Application && yarn install)
run: yarn install --cwd vendor/sylius/test-application

- name: Prepare test application database
run: |
(cd tests/Application && bin/console doctrine:database:create -vvv)
(cd tests/Application && bin/console doctrine:schema:create -vvv)
vendor/bin/console doctrine:database:create -vvv
vendor/bin/console doctrine:schema:create -vvv

- name: Prepare test application assets
run: |
(cd tests/Application && bin/console assets:install public -vvv)
(cd tests/Application && yarn encore dev)
vendor/bin/console assets:install -vvv
yarn --cwd vendor/sylius/test-application encore prod

- name: Prepare test application cache
run: (cd tests/Application && bin/console cache:warmup -vvv)
run: vendor/bin/console cache:warmup -vvv

- name: Load fixtures in test application
run: (cd tests/Application && bin/console sylius:fixtures:load -n)
run: vendor/bin/console sylius:fixtures:load -n

- name: Validate composer.json
run: composer validate --ansi --strict

- name: Validate database schema
run: (cd tests/Application && bin/console doctrine:schema:validate)
run: vendor/bin/console doctrine:schema:validate

- name: Run PHPStan
run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/
Expand All @@ -139,6 +135,12 @@ jobs:
- name: Run PHPSpec
run: vendor/bin/phpspec run --ansi -f progress --no-interaction

- name: Run Chrome Headless
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='*' http://127.0.0.1 > /dev/null 2>&1 &

- name: Run webserver
run: symfony server:start --port=8080 --daemon && symfony -V

- name: Run Behat
run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun

Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/var/
/vendor/
/node_modules/
/composer.lock
Expand All @@ -15,3 +16,8 @@
/public/build
/tests/Application/public/build
/tests/Application/public/banner

# TestApplication local files
/tests/TestApplication/.env.local
/tests/TestApplication/.env.test.local
/tests/TestApplication/.env.*.local
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import './scss/main.scss'

import './js'
import './js/previewBannerImage'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 5 additions & 20 deletions behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,22 @@ default:

Behat\MinkExtension:
files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/"
base_url: "http://127.0.0.1:8080/"
base_url: "https://127.0.0.1:8080/"
default_session: symfony
javascript_session: chrome_headless
javascript_session: chrome
sessions:
symfony:
symfony: ~
chrome_headless:
chrome:
chrome:
socket_timeout: 120
api_url: http://127.0.0.1:9222
validate_certificate: false
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"
extra_capabilities:
unexpectedAlertBehaviour: accept

FriendsOfBehat\SymfonyExtension:
bootstrap: tests/Application/config/bootstrap.php
bootstrap: vendor/sylius/test-application/config/bootstrap.php
kernel:
class: Tests\BitBag\SyliusBannerPlugin\Application\Kernel
class: Sylius\TestApplication\Kernel

FriendsOfBehat\VariadicExtension: ~

Expand Down
27 changes: 12 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"license": "MIT",
"require": {
"php": "^8.1",
"sylius/sylius": "^1.13"
"sylius/sylius": "^1.14"
},
"require-dev": {
"behat/behat": "^3.6.1",
Expand All @@ -35,6 +35,7 @@
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sylius-labs/coding-standard": "^4.0",
"sylius/test-application": "^1.14.x-dev",
"symfony/browser-kit": "^5.4 || ^6.4",
"symfony/debug-bundle": "^5.4 || ^6.4",
"symfony/dotenv": "^5.4 || ^6.4",
Expand All @@ -52,13 +53,15 @@
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true,
"symfony/flex": true,
"symfony/runtime": false,
"symfony/thanks": true
}
},
"extra": {
"branch-alias": {
"dev-master": "1.10-dev"
}
"dev-master": "2.2-dev"
},
"public-dir": "vendor/sylius/test-application/public"
},
"autoload": {
"psr-4": {
Expand All @@ -67,17 +70,11 @@
}
},
"autoload-dev": {
"classmap": ["tests/Application/Kernel.php"]
},
"scripts": {
"post-install-cmd": [
"php bin/create_node_symlink.php"
],
"post-update-cmd": [
"php bin/create_node_symlink.php"
],
"post-create-project-cmd": [
"php bin/create_node_symlink.php"
]
"psr-4": {
"Tests\\BitBag\\SyliusBannerPlugin\\": [
"tests/TestApplication/src",
"tests/Behat"
]
}
}
}
19 changes: 19 additions & 0 deletions doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,25 @@ bin/console doctrine:migrations:migrate
```
**Note:** If you are running it on production, add the `-e prod` flag to this command.

### Install assets:

Add the following line to your `assets/admin/entrypoint.js` file:

```
import '../../vendor/bitbag/banner-plugin/assets/admin/entrypoint';
```

And the following line to your `assets/shop/entrypoint.js` file:

```
import '../../vendor/bitbag/banner-plugin/assets/shop/entrypoint';
```

Then, run the following commands to install assets:
```bash
Run yarn encore dev or yarn encore production
```

### Clear application cache by using command:
```bash
bin/console cache:clear
Expand Down
2 changes: 1 addition & 1 deletion node_modules
3 changes: 2 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ parameters:
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false

excludes_analyse:
excludePaths:
# Makes PHPStan crash
- 'src/DependencyInjection/Configuration.php'

# Test dependencies
- 'tests/Application/app/**.php'
- 'tests/Application/src/**.php'
- 'tests/TestApplication/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\./'
6 changes: 2 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/8.5/phpunit.xsd"
colors="true"
bootstrap="tests/Application/config/bootstrap.php">
bootstrap="vendor/sylius/test-application/config/bootstrap.php">
<testsuites>
<testsuite name="BitBagSyliusBannerPlugin Test Suite">
<directory>tests</directory>
Expand All @@ -13,9 +13,7 @@
<php>
<ini name="error_reporting" value="-1" />

<server name="KERNEL_CLASS_PATH" value="/tests/Application/AppKernel.php" />
<server name="IS_DOCTRINE_ORM_SUPPORTED" value="true" />

<env name="KERNEL_CLASS" value="Sylius\TestApplication\Kernel" />
<env name="APP_ENV" value="test"/>
<env name="SHELL_VERBOSITY" value="-1" />
</php>
Expand Down
20 changes: 0 additions & 20 deletions src/Resources/public/entrypoints.json

This file was deleted.

6 changes: 0 additions & 6 deletions src/Resources/public/manifest.json

This file was deleted.

15 changes: 0 additions & 15 deletions tests/Application/.babelrc

This file was deleted.

36 changes: 0 additions & 36 deletions tests/Application/.env

This file was deleted.

3 changes: 0 additions & 3 deletions tests/Application/.env.test

This file was deleted.

20 changes: 0 additions & 20 deletions tests/Application/.eslintrc.js

This file was deleted.

Loading
Loading