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
47 changes: 24 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,17 @@ jobs:
tests:
runs-on: ubuntu-latest

name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }},
MySQL ${{ matrix.mysql }}"
name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"

strategy:
fail-fast: false
matrix:
php: ["8.1", "8.2", "8.3"]
symfony: ["^5.4.21", "^6.4"]
sylius: ["~1.13.0", "~1.14.0"]
node: ["^20.x"]
php: ["8.2", "8.3"]
symfony: ["^6.4", "^7.2"]
sylius: ["~2.0.0", "~2.1.0"]
node: ["22.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 +61,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 +73,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 +99,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 +134,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
Comment on lines 17 to 18
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be deleted


# TestApplication local files
/tests/TestApplication/.env.local
/tests/TestApplication/.env.test.local
/tests/TestApplication/.env.*.local
4 changes: 4 additions & 0 deletions assets/admin/controllers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"controllers": [],
"entrypoints": []
}
File renamed without changes.
4 changes: 4 additions & 0 deletions assets/shop/controllers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"controllers": [],
"entrypoints": []
}
1 change: 1 addition & 0 deletions assets/shop/entrypoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './js';
28 changes: 28 additions & 0 deletions assets/shop/js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Swiper from 'swiper';
import { Navigation, Autoplay } from 'swiper/modules';

import 'swiper/css';

const bannersCarousels = document.querySelectorAll('.banners-carousel')

for (let i= 0; i < bannersCarousels.length; i++ ) {

bannersCarousels[i].classList.add(`banners-carousel-${i}`);

const swiper = new Swiper(`.banners-carousel-${i}`, {
autoplay: {
delay: 5000,
},
loop: true,
modules: [Navigation, Autoplay],
navigation: {
nextEl: `.banners-carousel-${i} .swiper-button-next`,
prevEl: `.banners-carousel-${i} .swiper-button-prev`,
},
observeParents: true,
observer: true,
slidesPerView: 1,
spaceBetween: 32,
speed: 400,
});
}
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
45 changes: 0 additions & 45 deletions bin/create_node_symlink.php

This file was deleted.

46 changes: 22 additions & 24 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
],
"license": "MIT",
"require": {
"php": "^8.1",
"sylius/sylius": "^1.13"
"php": "^8.2",
"sylius/sylius": "^2.0"
},
"require-dev": {
"behat/behat": "^3.6.1",
Expand All @@ -28,19 +28,20 @@
"friends-of-behat/variadic-extension": "^1.3",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "1.4",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-doctrine": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpstan/phpstan-webmozart-assert": "^1.0",
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sylius-labs/coding-standard": "^4.0",
"symfony/browser-kit": "^5.4 || ^6.4",
"symfony/debug-bundle": "^5.4 || ^6.4",
"symfony/dotenv": "^5.4 || ^6.4",
"symfony/intl": "^5.4 || ^6.4",
"symfony/web-profiler-bundle": "^5.4 || ^6.4",
"symfony/webpack-encore-bundle": "^1.14",
"sylius/test-application": "^2.0.0@alpha",
"symfony/browser-kit": "^6.4 || ^7.2",
"symfony/debug-bundle": "^6.4 || ^7.2",
"symfony/dotenv": "^6.4 || ^7.2",
"symfony/intl": "^6.4 || ^7.2",
"symfony/web-profiler-bundle": "^6.4 || ^7.2",
"symfony/webpack-encore-bundle": "^2.2",
"doctrine/persistence": "^3.0"
},
"conflict": {
Expand All @@ -52,13 +53,16 @@
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true,
"symfony/flex": true,
"symfony/thanks": true
"symfony/runtime": false,
"symfony/thanks": true,
"php-http/discovery": false
}
},
"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 +71,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"
]
}
}
}
File renamed without changes.
23 changes: 23 additions & 0 deletions config/api_resources/properties/Ad.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--

This file has been created by developers from BitBag.
Feel free to contact us once you face any issues or want to start
You can find more information about us on https://bitbag.io and write us
an email on [email protected].

-->

<properties xmlns="https://api-platform.com/schema/metadata/properties-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/properties-3.0 https://api-platform.com/schema/metadata/properties-3.0.xsd"
>
<property resource="%bitbag_sylius_banner_plugin.model.ad.class%" name="id" identifier="true" writable="false"/>
<property resource="%bitbag_sylius_banner_plugin.model.ad.class%" name="code" writable="false"/>
<property resource="%bitbag_sylius_banner_plugin.model.ad.class%" name="name" writable="false"/>
<property resource="%bitbag_sylius_banner_plugin.model.ad.class%" name="startAt" writable="false"/>
<property resource="%bitbag_sylius_banner_plugin.model.ad.class%" name="endAt" writable="false"/>
<property resource="%bitbag_sylius_banner_plugin.model.ad.class%" name="priority" writable="false"/>
<property resource="%bitbag_sylius_banner_plugin.model.ad.class%" name="banners" writable="false"/>
</properties>
25 changes: 25 additions & 0 deletions config/api_resources/properties/Banner.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--

This file has been created by developers from BitBag.
Feel free to contact us once you face any issues or want to start
You can find more information about us on https://bitbag.io and write us
an email on [email protected].

-->

<properties xmlns="https://api-platform.com/schema/metadata/properties-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/properties-3.0 https://api-platform.com/schema/metadata/properties-3.0.xsd"
>
<property resource="%bitbag_sylius_banner_plugin.model.banner.class%" name="id" identifier="true" writable="false"/>
<property resource="%bitbag_sylius_banner_plugin.model.banner.class%" name="path" writable="false"/>
<property resource="%bitbag_sylius_banner_plugin.model.banner.class%" name="alt" writable="false"/>
<property resource="%bitbag_sylius_banner_plugin.model.banner.class%" name="fileName" writable="false"/>
<property resource="%bitbag_sylius_banner_plugin.model.banner.class%" name="link" writable="false"/>
<property resource="%bitbag_sylius_banner_plugin.model.banner.class%" name="priority" writable="false"/>
<property resource="%bitbag_sylius_banner_plugin.model.banner.class%" name="locale" writable="false"/>
<property resource="%bitbag_sylius_banner_plugin.model.banner.class%" name="section" writable="false"/>
<property resource="%bitbag_sylius_banner_plugin.model.banner.class%" name="ads" writable="false"/>
</properties>
Loading
Loading