Skip to content

Commit 43b53ea

Browse files
authored
Merge pull request #2 from lanfisis/master
2 parents 46b6a7a + 3549ebc commit 43b53ea

File tree

8 files changed

+88
-60
lines changed

8 files changed

+88
-60
lines changed

.github/workflows/recipe.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
php: ['8.2']
20-
sylius: ["~1.12.0"]
20+
sylius: ["~1.12.0", "~1.13.0"]
2121

2222
steps:
2323
- name: Setup PHP

.github/workflows/security.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ jobs:
2525
with:
2626
php-version: ${{ matrix.php }}
2727
extensions: gd, intl, json
28-
ini-values: date.timezone=UTC
2928

3029
- name: Set project php-version
3130
run: |
32-
echo ${{ matrix.php }} > .php-version
31+
echo "${{ matrix.php }}" > .php-version
3332
3433
- name: Determine composer cache directory
3534
id: composer-cache-directory
@@ -40,8 +39,9 @@ jobs:
4039
id: cache-composer
4140
with:
4241
path: ${{ steps.composer-cache-directory.outputs.directory }}
43-
key: composer2-php:${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
42+
key: composer2-php:${{ matrix.php }}-${{ github.sha }}
4443
restore-keys: composer2-php:${{ matrix.php }}-
44+
4545
- name: Ensure that composer cache directory exists
4646
run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }}
4747

@@ -52,4 +52,3 @@ jobs:
5252
run: composer update --prefer-dist
5353

5454
- uses: symfonycorp/security-checker-action@v4
55-

.github/workflows/tests.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ jobs:
99

1010
php:
1111

12-
name: Quality tests (PHP ${{ matrix.php }})
13-
1412
runs-on: ubuntu-latest
1513

1614
strategy:
@@ -19,6 +17,7 @@ jobs:
1917
php: ['8.2']
2018

2119
env:
20+
SYMFONY_ARGS: --no-tls
2221
COMPOSER_ARGS: --prefer-dist
2322
DOCKER_INTERACTIVE_ARGS: -t
2423

@@ -39,7 +38,7 @@ jobs:
3938

4039
- name: Set project php-version
4140
run: |
42-
echo ${{ matrix.php }} > .php-version
41+
echo "${{ matrix.php }}" > .php-version
4342
4443
- name: Determine composer cache directory
4544
id: composer-cache-directory
@@ -50,7 +49,7 @@ jobs:
5049
id: cache-composer
5150
with:
5251
path: ${{ steps.composer-cache-directory.outputs.directory }}
53-
key: composer2-php:${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
52+
key: composer2-php:${{ matrix.php }}-${{ github.sha }}
5453
restore-keys: composer2-php:${{ matrix.php }}-
5554

5655
- name: Ensure that composer cache directory exists
@@ -69,6 +68,8 @@ jobs:
6968

7069
- run: make test.phpmd
7170

71+
- run: make test.phpspec
72+
7273
- run: make test.yaml
7374

7475
- run: make test.twig

Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
.DEFAULT_GOAL := help
22
SHELL=/bin/bash
33
APP_DIR=tests/Application
4-
SYLIUS_VERSION=1.12.0
4+
SYLIUS_VERSION=1.13.0
55
SYMFONY=cd ${APP_DIR} && symfony
66
COMPOSER=symfony composer
77
CONSOLE=${SYMFONY} console
88
export COMPOSE_PROJECT_NAME=sylius_cms_block_plugin
99
PLUGIN_NAME=sylius-cms-block-plugin
10-
COMPOSE=docker-compose
10+
COMPOSE=docker compose
1111
YARN=yarn
1212
DOCTRINE_MIGRATIONS_NAMESPACE=MonsieurBiz\SyliusCmsBlockPlugin\Migrations
1313

@@ -86,6 +86,8 @@ setup_application:
8686
${APP_DIR}/docker-compose.yaml:
8787
rm -f ${APP_DIR}/docker-compose.yml
8888
rm -f ${APP_DIR}/docker-compose.yaml
89+
rm -f ${APP_DIR}/compose.yml # Remove Sylius file about Docker
90+
rm -f ${APP_DIR}/compose.override.dist.yml # Remove Sylius file about Docker
8991
ln -s ../../docker-compose.yaml.dist ${APP_DIR}/docker-compose.yaml
9092
.PHONY: ${APP_DIR}/docker-compose.yaml
9193

@@ -110,7 +112,7 @@ apply_dist:
110112
### TESTS
111113
### ¯¯¯¯¯
112114

113-
test.all: test.composer test.phpstan test.phpmd test.phpcs test.yaml test.schema test.twig test.container ## Run all tests in once
115+
test.all: test.composer test.phpstan test.phpmd test.phpspec test.phpcs test.yaml test.schema test.twig test.container ## Run all tests in once
114116

115117
test.composer: ## Validate composer.json
116118
${COMPOSER} validate --strict
@@ -121,6 +123,9 @@ test.phpstan: ## Run PHPStan
121123
test.phpmd: ## Run PHPMD
122124
${COMPOSER} phpmd
123125

126+
test.phpspec: ## Run PHPSpec
127+
${COMPOSER} phpspec
128+
124129
test.phpcs: ## Run PHP CS Fixer in dry-run
125130
${COMPOSER} run -- phpcs --dry-run -v
126131

README.md

Lines changed: 56 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,58 @@
1-
# Sylius Cms Block Plugin
1+
<h1 align="center">Sylius Cms Block Plugin</h1>
2+
3+
[![Tests Status](https://img.shields.io/github/actions/workflow/status/monsieurbiz/SyliusCmsBlockPlugin/tests.yaml?branch=master&logo=github)](https://github.com/monsieurbiz/SyliusCmsBlockPlugin/actions?query=workflow%3ATests)
4+
[![Recipe Status](https://img.shields.io/github/actions/workflow/status/monsieurbiz/SyliusCmsBlockPlugin/recipe.yaml?branch=master&label=recipes&logo=github)](https://github.com/monsieurbiz/SyliusCmsBlockPlugin/actions?query=workflow%3ASecurity)
5+
[![Security Status](https://img.shields.io/github/actions/workflow/status/monsieurbiz/SyliusCmsBlockPlugin/security.yaml?branch=master&label=security&logo=github)](https://github.com/monsieurbiz/SyliusCmsBlockPlugin/actions?query=workflow%3ASecurity)
6+
7+
## Compatibility
8+
9+
| Sylius Version | PHP Version |
10+
|---|-------------|
11+
| 1.12 | 8.2 |
12+
| 1.13 | 8.2 |
13+
14+
## Installation
15+
16+
If you want to use our recipes, you can configure your composer.json by running:
17+
18+
```bash
19+
composer config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]'
20+
```
21+
22+
```bash
23+
composer require monsieurbiz/sylius-cms-block-plugin
24+
```
25+
Change your `config/bundles.php` file to add the line for the plugin :
26+
```php
27+
<?php
28+
return [
29+
//..
30+
MonsieurBiz\SyliusCmsBlockPlugin\MonsieurBizSyliusCmsBlockPlugin::class => ['all' => true],
31+
];
32+
```
33+
Then create the config file in `config/packages/monsieurbiz_sylius_cms_block_plugin.yaml` :
34+
```yaml
35+
imports:
36+
resource: '@MonsieurBizSyliusCmsBlockPlugin/Resources/config/config.yaml'
37+
```
38+
Finally import the routes in `config/routes/monsieurbiz_sylius_cms_block_plugin.yaml` :
39+
```yaml
40+
imports:
41+
resource: '@MonsieurBizSyliusCmsBlockPlugin/Resources/config/routes.yaml'
42+
```
43+
### Migrations
44+
First, please run legacy-versioned migrations by using command :
45+
```bash
46+
bin/console doctrine:migrations:migrate
47+
```
48+
After migration, please create a new diff migration :
49+
```php
50+
bin/console doctrine:migrations:diff
51+
```
52+
Then run it (if any) :
53+
```php
54+
bin/console doctrine:migrations:migrate
55+
```
256

357
## Example
458

@@ -16,7 +70,7 @@ Manage the content of your block, you can decide to disable or enable it to disp
1670

1771
### Include it in your content
1872

19-
For example in your [Homepage](https://github.com/monsieurbiz/SyliusHomepagePlugin) ou [CMS Page](https://github.com/monsieurbiz/SyliusCmsPagePlugin/) !
73+
For example in your [Homepage](https://github.com/monsieurbiz/SyliusHomepagePlugin) ou [CMS Page](https://github.com/monsieurbiz/SyliusCmsBlockPlugin/) !
2074

2175
![Block included in a homepage content](images/block-included.jpg)
2276

@@ -36,14 +90,6 @@ You can use it in multiple places, it will shown the same content everywhere.
3690

3791
If you disable the block, it will not be displayed anymore.
3892

39-
## Installation
40-
41-
Run the recipe and run migrations
42-
43-
```
44-
console doctrine:migrations:migrate -n
45-
```
46-
4793
## License
4894

4995
This plugin is under the MIT license.

composer.json

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,19 @@
55
"description": "Save rich editor contents in database and use it as UI Element",
66
"license": "MIT",
77
"require": {
8-
"monsieurbiz/sylius-rich-editor-plugin": "^2.0",
8+
"monsieurbiz/sylius-rich-editor-plugin": "^2.8",
99
"php": "^8.2",
10-
"sylius/sylius": ">=1.12 <1.13"
10+
"sylius/sylius": ">=1.12 <1.14"
1111
},
1212
"require-dev": {
1313
"behat/behat": "^3.6.1",
14-
"behat/mink-selenium2-driver": "^1.4",
15-
"dmore/behat-chrome-extension": "^1.3",
16-
"dmore/chrome-mink-driver": "^2.7",
17-
"friends-of-behat/mink": "^1.8",
18-
"friends-of-behat/mink-browserkit-driver": "^1.4",
19-
"friends-of-behat/mink-debug-extension": "^2.0.0",
20-
"friends-of-behat/mink-extension": "^2.4",
21-
"friends-of-behat/page-object-extension": "^0.3",
22-
"friends-of-behat/suite-settings-extension": "^1.0",
23-
"friends-of-behat/symfony-extension": "^2.1",
24-
"friends-of-behat/variadic-extension": "^1.3",
25-
"phpspec/phpspec": "^7.2",
26-
"phpstan/extension-installer": "^1.0",
27-
"phpstan/phpstan": "^1.8.1",
28-
"phpstan/phpstan-doctrine": "1.3.40",
29-
"phpstan/phpstan-strict-rules": "^1.3.0",
30-
"phpstan/phpstan-webmozart-assert": "^1.2.0",
31-
"phpunit/phpunit": "^9.5",
32-
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
33-
"sylius-labs/coding-standard": "^4.2",
34-
"symfony/browser-kit": "^5.4 || ^6.0",
35-
"symfony/debug-bundle": "^5.4 || ^6.0",
36-
"symfony/dotenv": "^5.4 || ^6.0",
37-
"symfony/flex": "^2.2.2",
38-
"symfony/intl": "^5.4 || ^6.0",
39-
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
40-
"vimeo/psalm": "5.12.0",
41-
"phpmd/phpmd": "^2.13",
42-
"friendsofphp/php-cs-fixer": "^3.16"
43-
14+
"friendsofphp/php-cs-fixer": "^3.16",
15+
"phpspec/phpspec": "^7.0",
16+
"phpstan/phpstan": "^1.8.4",
17+
"phpstan/phpstan-doctrine": "^1.3.2",
18+
"phpstan/phpstan-webmozart-assert": "^1.1",
19+
"phpunit/phpunit": "^10.5",
20+
"phpmd/phpmd": "^2.15"
4421
},
4522
"prefer-stable": true,
4623
"autoload": {
@@ -63,8 +40,8 @@
6340
"symfony": {
6441
"docker": false,
6542
"endpoint": [
66-
"https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master",
67-
"flex://defaults"
43+
"https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master",
44+
"flex://defaults"
6845
]
6946
},
7047
"branch-alias": {

phpstan.neon

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ parameters:
33
paths:
44
- %rootDir%/src/
55

6-
checkMissingIterableValueType: false
7-
checkGenericClassInNonGenericObjectType: false
8-
96
excludePaths:
107
# Makes PHPStan crash
118
- 'src/DependencyInjection/SyliusCmsBlockExtension.php'
129

1310
# Test dependencies
1411
- 'tests/Application/**/*'
12+
13+
ignoreErrors:
14+
- identifier: missingType.iterableValue

src/Form/Type/UiElement/BlockType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
4747
},
4848
'class' => Block::class,
4949
'multiple' => false,
50-
'choice_label' => fn (BlockInterface $block): string => sprintf('[%s] %s', $block->getCode(), $block->getName()),
50+
'choice_label' => fn (BlockInterface $block): string => \sprintf('[%s] %s', $block->getCode(), $block->getName()),
5151
'query_builder' => function (BlockRepository $blockRepository) {
5252
return $blockRepository->createListQueryBuilder($this->localeContext->getLocaleCode())
5353
->addOrderBy('o.code', 'ASC')

0 commit comments

Comments
 (0)