Skip to content

Commit

Permalink
Merge pull request #1 from maximehuran/feature/1.14
Browse files Browse the repository at this point in the history
  • Loading branch information
maximehuran authored Jan 24, 2025
2 parents ef44db5 + 4aeb447 commit 8d4991c
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 89 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.2']
sylius: ["~1.12.0"]
php: ['8.2', '8.3']
sylius: ["~1.12.0", "~1.13.0", "~1.14.0"]

steps:
- name: Setup PHP
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.2']
php: ['8.2', '8.3']

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.2']
php: ['8.2', '8.3']

env:
COMPOSER_ARGS: --prefer-dist
Expand Down
2 changes: 1 addition & 1 deletion .php-version.dist
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.2
8.3
45 changes: 20 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
.DEFAULT_GOAL := help
SHELL=/bin/bash
APP_DIR=tests/Application
SYLIUS_VERSION=1.12.0
SYLIUS_VERSION=1.14.0
SYMFONY=cd ${APP_DIR} && symfony
COMPOSER=symfony composer
CONSOLE=${SYMFONY} console
export COMPOSE_PROJECT_NAME=sylius_markerio_plugin
PLUGIN_NAME=sylius-markerio-plugin
COMPOSE=docker-compose
export COMPOSE_PROJECT_NAME=markerio
export MIGRATIONS_NAMESPACE=MonsieurBiz\\SyliusMarkerioPlugin\\Migrations
export USER_UID=$(shell id -u)
PLUGIN_NAME=sylius-${COMPOSE_PROJECT_NAME}-plugin
COMPOSE=docker compose
YARN=yarn
DOCTRINE_MIGRATIONS_NAMESPACE=MonsieurBiz\SyliusMarkerioPlugin\Migrations


###
### DEVELOPMENT
Expand Down Expand Up @@ -76,16 +76,17 @@ setup_application:
(cd ${APP_DIR} && ${COMPOSER} require --no-install --no-scripts --no-progress sylius/sylius="~${SYLIUS_VERSION}") # Make sure to install the required version of sylius because the sylius-standard has a soft constraint
$(MAKE) ${APP_DIR}/.php-version
$(MAKE) ${APP_DIR}/php.ini
(cd ${APP_DIR} && ${COMPOSER} require --no-progress api-platform/core="2.7.16")
(cd ${APP_DIR} && ${COMPOSER} install --no-interaction)
$(MAKE) apply_dist
(cd ${APP_DIR} && ${COMPOSER} require --no-progress monsieurbiz/${PLUGIN_NAME}="*@dev")
(cd ${APP_DIR} && ${COMPOSER} require --no-progress --no-interaction monsieurbiz/${PLUGIN_NAME}="*@dev")
rm -rf ${APP_DIR}/var/cache


${APP_DIR}/docker-compose.yaml:
rm -f ${APP_DIR}/docker-compose.yml
rm -f ${APP_DIR}/docker-compose.yaml
rm -f ${APP_DIR}/compose.yml # Remove Sylius file about Docker
rm -f ${APP_DIR}/compose.override.dist.yml # Remove Sylius file about Docker
ln -s ../../docker-compose.yaml.dist ${APP_DIR}/docker-compose.yaml
.PHONY: ${APP_DIR}/docker-compose.yaml

Expand All @@ -110,7 +111,7 @@ apply_dist:
### TESTS
### ¯¯¯¯¯

test.all: test.composer test.phpstan test.phpmd test.phpcs test.yaml test.schema test.twig test.container ## Run all tests in once
test.all: test.composer test.phpstan test.phpmd test.phpunit test.phpspec test.phpcs test.yaml test.schema test.twig test.container ## Run all tests in once

test.composer: ## Validate composer.json
${COMPOSER} validate --strict
Expand All @@ -121,6 +122,12 @@ test.phpstan: ## Run PHPStan
test.phpmd: ## Run PHPMD
${COMPOSER} phpmd

test.phpunit: ## Run PHPUnit
${COMPOSER} phpunit

test.phpspec: ## Run PHPSpec
${COMPOSER} phpspec

test.phpcs: ## Run PHP CS Fixer in dry-run
${COMPOSER} run -- phpcs --dry-run -v

Expand All @@ -131,29 +138,14 @@ test.container: ## Lint the symfony container
${CONSOLE} lint:container

test.yaml: ## Lint the symfony Yaml files
${CONSOLE} lint:yaml ../../recipes ../../src/Resources/config
${CONSOLE} lint:yaml ../../src/Resources/config --parse-tags

test.schema: ## Validate MySQL Schema
${CONSOLE} doctrine:schema:validate

test.twig: ## Validate Twig templates
${CONSOLE} lint:twig --no-debug templates/ ../../src/Resources/views/

###
### MIGRATIONS
### ¯¯¯¯¯¯¯¯¯¯

app.doctrine.migration.diff: ## create a diff migration file for the Test Application
${CONSOLE} doctrine:migrations:diff --namespace="App\Migrations"

doctrine.migration.diff: ## create a diff migration file for the plugin
${CONSOLE} doctrine:migrations:diff --namespace="${DOCTRINE_MIGRATIONS_NAMESPACE}"
.PHONY: doctrine.migration.diff

doctrine.migration.migrate: ## Run migrations
${CONSOLE} doctrine:migration:migrate -n
.PHONY: doctrine.migration.migrate

###
### SYLIUS
### ¯¯¯¯¯¯
Expand All @@ -177,6 +169,9 @@ sylius.assets: ## Install all assets with symlinks
messenger.setup: ## Setup Messenger transports
${CONSOLE} messenger:setup-transports

doctrine.diff: ## Doctrine diff
${CONSOLE} doctrine:migration:diff --namespace="${MIGRATIONS_NAMESPACE}"

###
### PLATFORM
### ¯¯¯¯¯¯¯¯
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,22 @@ This plugin is a Sylius integration for [Marker.io](https://marker.io).
It gives the capability to integrate the extension if you have a Project ID.
In the same time, if the script is loaded, we've added some metadata to the configuration sent to Marker.io.

## Compatibility

| Sylius Version | PHP Version |
|----------------|-----------------|
| 1.12 | 8.1 - 8.2 - 8.3 |
| 1.13 | 8.1 - 8.2 - 8.3 |
| 1.14 | 8.1 - 8.2 - 8.3 |

## Installation

If you want to use our recipes, you can configure your composer.json by running:

```bash
composer config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]'
```

```
composer require monsieurbiz/sylius-markerio-plugin
```
Expand Down
59 changes: 16 additions & 43 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,21 @@
{
"name": "monsieurbiz/sylius-markerio-plugin",
"type": "sylius-plugin",
"keywords": ["sylius", "sylius-plugin"],
"keywords": ["sylius", "sylius-plugin", "monsieurbiz"],
"description": "",
"license": "MIT",
"require": {
"php": "^8.2",
"sylius/sylius": ">=1.12 <1.13",
"sylius/sylius": ">=1.12 <2.0",
"monsieurbiz/sylius-settings-plugin": "^1.0"
},
"require-dev": {
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "^1.4",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
"friends-of-behat/mink-browserkit-driver": "^1.4",
"friends-of-behat/mink-debug-extension": "^2.0.0",
"friends-of-behat/mink-extension": "^2.4",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"phpspec/phpspec": "^7.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.8.1",
"phpstan/phpstan-doctrine": "1.3.40",
"phpstan/phpstan-strict-rules": "^1.3.0",
"phpstan/phpstan-webmozart-assert": "^1.2.0",
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sylius-labs/coding-standard": "^4.2",
"symfony/browser-kit": "^5.4 || ^6.0",
"symfony/debug-bundle": "^5.4 || ^6.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/flex": "^2.2.2",
"symfony/intl": "^5.4 || ^6.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
"vimeo/psalm": "5.12.0",
"friendsofphp/php-cs-fixer": "^3.51",
"friendsofphp/php-cs-fixer": "^3.16",
"phpspec/phpspec": "^7.0",
"phpstan/phpstan": "^1.8.4",
"phpstan/phpstan-doctrine": "^1.3.2",
"phpstan/phpstan-webmozart-assert": "^1.1",
"phpunit/phpunit": "^10.5",
"phpmd/phpmd": "^2.15"
},
"prefer-stable": true,
Expand All @@ -52,32 +29,28 @@
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"phpcs": "php-cs-fixer fix --using-cache=no",
"phpcs": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --using-cache=no",
"phpstan": "phpstan analyse -c phpstan.neon src/",
"phpmd": "phpmd --exclude Migrations/* src/ ansi phpmd.xml",
"phpunit": "phpunit",
"phpspec": "phpspec run"
},
"extra": {
"symfony": {
"docker": false,
"endpoint": [
"https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master",
"flex://defaults"
]
},
"branch-alias": {
"dev-master": "1.0-dev"
},
"symfony": {
"docker": false,
"endpoint": ["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master", "flex://defaults"]
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"symfony/thanks": true,
"ergebnis/composer-normalize": true,
"symfony/flex": true,
"php-http/discovery": false,
"phpstan/extension-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"ergebnis/composer-normalize": true,
"php-http/discovery": true
}
}
}
3 changes: 1 addition & 2 deletions docker-compose.yaml.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.8'
services:
database:
image: mysql:8.0
Expand All @@ -18,4 +17,4 @@ services:
- 1080

volumes:
database: {}
database: {}
19 changes: 10 additions & 9 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
parameters:
level: max
level: 8
paths:
- %currentWorkingDirectory%/src/
- %rootDir%/src/

checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
excludePaths:
# Test dependencies
- 'tests/Application/**/*'

scanDirectories:
- %currentWorkingDirectory%/tests/Application/src/

bootstrapFiles:
- %currentWorkingDirectory%/vendor/autoload.php
ignoreErrors:
- identifier: missingType.generics
- identifier: missingType.iterableValue

reportUnmatchedIgnoredErrors: false
8 changes: 3 additions & 5 deletions src/EventListener/MarkerioCustomDataListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

namespace MonsieurBiz\SyliusMarkerioPlugin\EventListener;

use App\Entity\Order\OrderItem;
use App\Entity\Product\ProductVariant;
use App\Entity\User\AdminUser;
use MonsieurBiz\SyliusMarkerioPlugin\Event\MarkerioCustomDataEvent;
use MonsieurBiz\SyliusMarkerioPlugin\Event\MarkerioCustomDataEventInterface;
use Sylius\Component\Core\Context\ShopperContextInterface;
use Sylius\Component\Core\Model\AdminUser;
use Sylius\Component\Core\Model\OrderItem;
use Sylius\Component\Core\Model\ProductVariant;
use Sylius\Component\Order\Context\CartContextInterface;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
use Symfony\Component\HttpFoundation\RequestStack;
Expand Down Expand Up @@ -109,11 +109,9 @@ private function getAdminToken(): ?AbstractToken
}

if (null === $this->adminToken) {
// @phpstan-ignore-next-line
$this->adminToken = unserialize((string) $session->get('_security_admin'));
}

// @phpstan-ignore-next-line
return $this->adminToken;
}
}
Empty file added tests/Unit/.gitkeep
Empty file.

0 comments on commit 8d4991c

Please sign in to comment.