Skip to content

Commit 8df42e8

Browse files
authored
Add initial product bundle (#382)
1 parent a7a49b8 commit 8df42e8

145 files changed

Lines changed: 14148 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: Test application
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- '[0-9]+.x'
8+
- '[0-9]+.[0-9]+'
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
php:
17+
name: "PHP ${{ matrix.php-version }} (${{ matrix.database }}, ${{ matrix.dependency-versions }})"
18+
runs-on: ubuntu-22.04
19+
timeout-minutes: 30
20+
21+
env:
22+
APP_ENV: test
23+
APP_SECRET: a448d1dfcaa563fce56c2fd9981f662b
24+
MAILER_URL: null://localhost
25+
SULU_ADMIN_EMAIL:
26+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
include:
32+
- php-version: '8.2'
33+
database: mysql-57
34+
dependency-versions: 'lowest'
35+
php-extensions: 'ctype, iconv, mysql, gd'
36+
tools: 'composer:v2'
37+
env:
38+
SYMFONY_DEPRECATIONS_HELPER: disabled
39+
DATABASE_URL: mysql://root@127.0.0.1:3306/sulu_test?serverVersion=5.7&charset=utf8mb4
40+
41+
- php-version: '8.3'
42+
database: mysql-80
43+
dependency-versions: 'highest'
44+
php-extensions: 'ctype, iconv, mysql, gd'
45+
tools: 'composer:v2'
46+
env:
47+
SYMFONY_DEPRECATIONS_HELPER: weak
48+
DATABASE_URL: mysql://root:ChangeMe@127.0.0.1:3306/sulu_test?serverVersion=8.0&charset=utf8mb4
49+
50+
- php-version: '8.4'
51+
database: mysql-80
52+
dependency-versions: 'highest'
53+
php-extensions: 'ctype, iconv, mysql, gd'
54+
tools: 'composer:v2'
55+
env:
56+
SYMFONY_DEPRECATIONS_HELPER: weak
57+
DATABASE_URL: mysql://root:ChangeMe@127.0.0.1:3306/sulu_test?serverVersion=8.0&charset=utf8mb4
58+
59+
steps:
60+
- name: Checkout project
61+
uses: actions/checkout@v4
62+
63+
- name: Start Database
64+
run: docker compose -f tests/docker/docker-compose.${{ matrix.database }}.yml up --wait
65+
66+
- name: Install and configure PHP
67+
uses: shivammathur/setup-php@v2
68+
with:
69+
php-version: ${{ matrix.php-version }}
70+
extensions: ${{ matrix.php-extensions }}
71+
tools: ${{ matrix.tools }}
72+
ini-values: memory_limit=-1
73+
coverage: none
74+
75+
- name: Install composer dependencies
76+
uses: ramsey/composer-install@v3
77+
with:
78+
dependency-versions: ${{ matrix.dependency-versions }}
79+
80+
- name: Bootstrap test environment
81+
run: composer bootstrap-test-environment
82+
env: ${{ matrix.env }}
83+
84+
- name: Execute test cases
85+
run: composer test
86+
env: ${{ matrix.env }}
87+
88+
php-coverage:
89+
name: "PHP Coverage"
90+
runs-on: ubuntu-22.04
91+
timeout-minutes: 30
92+
93+
env:
94+
APP_ENV: test
95+
APP_SECRET: a448d1dfcaa563fce56c2fd9981f662b
96+
MAILER_URL: null://localhost
97+
SULU_ADMIN_EMAIL:
98+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
SYMFONY_DEPRECATIONS_HELPER: weak
100+
DATABASE_URL: mysql://root:ChangeMe@127.0.0.1:3306/sulu_test?serverVersion=8.0&charset=utf8mb4
101+
102+
steps:
103+
- name: Checkout project
104+
uses: actions/checkout@v4
105+
106+
- name: Start Database
107+
run: docker compose -f tests/docker/docker-compose.mysql-80.yml up --wait
108+
109+
- name: Install and configure PHP
110+
uses: shivammathur/setup-php@v2
111+
with:
112+
php-version: '8.3'
113+
extensions: 'ctype, iconv, mysql, gd, pcov'
114+
tools: 'composer:v2'
115+
ini-values: memory_limit=-1
116+
coverage: pcov
117+
118+
- name: Install composer dependencies
119+
uses: ramsey/composer-install@v3
120+
with:
121+
dependency-versions: highest
122+
123+
- name: Bootstrap test environment
124+
run: composer bootstrap-test-environment
125+
126+
- name: Execute tests with coverage
127+
run: composer test-with-coverage
128+
129+
- name: Check coverage
130+
run: composer check-coverage
131+
132+
- name: Upload coverage report
133+
uses: actions/upload-artifact@v4
134+
if: always()
135+
with:
136+
name: code-coverage-report
137+
path: tests/reports/html
138+
retention-days: 7
139+
140+
- name: Publish test results
141+
uses: actions/upload-artifact@v4
142+
if: always()
143+
with:
144+
name: test-results
145+
path: tests/reports/junit.xml
146+
retention-days: 7

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# PHPUnit
2+
/phpunit.xml
3+
.phpunit.result.cache
4+
5+
coverage-report
6+
var
7+
8+
# Composer
9+
/composer.phar
10+
/composer.lock
11+
/auth.json
12+
/vendor
13+
14+
# IDEs
15+
.idea/*
16+
*.iml
17+
*~
18+
19+
# System files
20+
.DS_Store
21+
22+
# tests
23+
tests/Application/var
24+
25+
# php-cs-fixer
26+
.php_cs.cache
27+
.php-cs-fixer.cache
28+
29+
# Symfony
30+
.env.local
31+
.env.*.local
32+
33+
# Test reports
34+
/tests/reports/
35+
/coverage/

.php-cs-fixer.dist.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
$header = <<<EOF
4+
This file is part of Sulu.
5+
6+
(c) Sulu GmbH
7+
8+
This source file is subject to the MIT license that is bundled
9+
with this source code in the file LICENSE.
10+
EOF;
11+
12+
$finder = PhpCsFixer\Finder::create()
13+
->exclude(['var/cache', 'tests/Application/var', 'node_modules'])
14+
->in(__DIR__);
15+
16+
$config = new PhpCsFixer\Config();
17+
$config->setRiskyAllowed(true)
18+
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
19+
->setRules([
20+
'@Symfony' => true,
21+
'array_syntax' => ['syntax' => 'short'],
22+
'class_definition' => false,
23+
'concat_space' => ['spacing' => 'one'],
24+
'function_declaration' => ['closure_function_spacing' => 'none'],
25+
'header_comment' => ['header' => $header],
26+
'native_constant_invocation' => true,
27+
'native_function_casing' => true,
28+
'native_function_invocation' => ['include' => ['@internal']],
29+
'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false],
30+
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'remove_inheritdoc' => true],
31+
'ordered_imports' => true,
32+
'phpdoc_align' => ['align' => 'left'],
33+
'phpdoc_types_order' => false,
34+
'single_line_throw' => false,
35+
'single_line_comment_spacing' => false,
36+
'phpdoc_to_comment' => [
37+
'ignored_tags' => ['todo', 'var', 'see'],
38+
],
39+
'phpdoc_separation' => [
40+
'groups' => [
41+
['Serializer\\*', 'VirtualProperty', 'Accessor', 'Type', 'Groups', 'Expose', 'Exclude', 'SerializedName', 'Inline', 'ExclusionPolicy'],
42+
],
43+
],
44+
'nullable_type_declaration_for_default_null_value' => true,
45+
'no_null_property_initialization' => false,
46+
'fully_qualified_strict_types' => false,
47+
'new_with_parentheses' => true,
48+
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['array_destructuring', 'arrays', 'match']],
49+
'no_useless_else' => false,
50+
])
51+
->setFinder($finder);
52+
53+
return $config;

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Sulu GmbH
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

composer-dependency-analyser.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Sulu.
5+
*
6+
* (c) Sulu GmbH
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
12+
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
13+
14+
require __DIR__ . '/vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php'; // see https://github.com/shipmonk-rnd/composer-dependency-analyser/issues/147#issuecomment-2202156380
15+
16+
$config = new Configuration();
17+
18+
$config->addPathRegexesToExclude([
19+
'#/var/(cache|log)/#',
20+
'#/vendor/sulu/sulu/#', // sulu/sulu test files are mapped via autoload-dev but are not our code
21+
]);
22+
23+
return $config;

composer.json

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
{
2+
"name": "sulu/product-bundle",
3+
"type": "symfony-bundle",
4+
"description": "Sulu Product Bundle",
5+
"license": "MIT",
6+
"require": {
7+
"php": "^8.2",
8+
"cmsig/seal": "^0.12",
9+
"doctrine/collections": "^2.0",
10+
"doctrine/orm": "^3.0",
11+
"sulu/messenger": "^1.0",
12+
"sulu/sulu": "~3.0",
13+
"symfony/config": "^7.0",
14+
"symfony/dependency-injection": "^7.0",
15+
"symfony/event-dispatcher": "^7.0",
16+
"symfony/http-foundation": "^7.0",
17+
"symfony/http-kernel": "^7.0",
18+
"symfony/messenger": "^7.0",
19+
"symfony/routing": "^7.0",
20+
"symfony/security-core": "^7.0",
21+
"symfony/serializer": "^7.0",
22+
"symfony/translation-contracts": "^3.0",
23+
"symfony/uid": "^7.0",
24+
"twig/twig": "^3.0",
25+
"webmozart/assert": "^1.0"
26+
},
27+
"require-dev": {
28+
"ext-filter": "*",
29+
"handcraftedinthealps/code-coverage-checker": "^0.2.1",
30+
"jangregor/phpstan-prophecy": "^2.0",
31+
"php-cs-fixer/shim": "^3.14",
32+
"phpspec/prophecy": "^1.0",
33+
"phpspec/prophecy-phpunit": "^2.0",
34+
"phpstan/phpstan": "^2.0",
35+
"phpstan/phpstan-doctrine": "^2.0",
36+
"phpstan/phpstan-phpunit": "^2.0",
37+
"phpstan/phpstan-symfony": "^2.0",
38+
"phpstan/phpstan-webmozart-assert": "^2.0",
39+
"phpunit/phpunit": "^11.0",
40+
"rector/rector": "^2.0",
41+
"shipmonk/composer-dependency-analyser": "^1.0",
42+
"spaze/phpstan-disallowed-calls": "^4.7",
43+
"symfony/browser-kit": "^8.0",
44+
"symfony/console": "^7.0",
45+
"symfony/dotenv": "^7.0",
46+
"symfony/framework-bundle": "^7.0",
47+
"cmsig/seal-memory-adapter": "^0.12.10"
48+
},
49+
"autoload": {
50+
"psr-4": {
51+
"Sulu\\Product\\": "src/"
52+
}
53+
},
54+
"autoload-dev": {
55+
"psr-4": {
56+
"Sulu\\Product\\Tests\\": "tests/",
57+
"Sulu\\Content\\Tests\\": "vendor/sulu/sulu/packages/content/tests/"
58+
}
59+
},
60+
"scripts": {
61+
"bootstrap-test-environment": [
62+
"@php tests/Application/bin/console.php doctrine:database:drop --if-exists --force --env test",
63+
"@php tests/Application/bin/console.php doctrine:database:create --env test",
64+
"@php tests/Application/bin/console.php doctrine:schema:update --force --complete --env test"
65+
],
66+
"test": "@php vendor/bin/phpunit",
67+
"test-with-coverage": "@php vendor/bin/phpunit --coverage-php tests/reports/coverage.php --coverage-html tests/reports/html --log-junit tests/reports/junit.xml",
68+
"check-coverage": "@php vendor/bin/code-coverage-checker \"tests/reports/coverage.php\" \"line\" \"100.00\"",
69+
"lint": [
70+
"@lint-composer",
71+
"@lint-composer-dependencies",
72+
"@lint-doctrine",
73+
"@lint-container",
74+
"@lint-yaml",
75+
"@lint-rector",
76+
"@php-cs",
77+
"@phpstan"
78+
],
79+
"fix": [
80+
"@rector",
81+
"@php-cs-fix"
82+
],
83+
"phpstan": [
84+
"@php tests/Application/bin/console.php cache:warmup --env test",
85+
"@php vendor/bin/phpstan analyse"
86+
],
87+
"php-cs": "@php vendor/bin/php-cs-fixer fix --verbose --diff --dry-run",
88+
"php-cs-fix": "@php vendor/bin/php-cs-fixer fix",
89+
"lint-rector": [
90+
"Composer\\Config::disableProcessTimeout",
91+
"@php tests/Application/bin/console.php cache:warmup --env test",
92+
"@php vendor/bin/rector process --dry-run"
93+
],
94+
"rector": [
95+
"Composer\\Config::disableProcessTimeout",
96+
"@php vendor/bin/rector process"
97+
],
98+
"lint-composer": "@composer validate --strict",
99+
"lint-composer-dependencies": "@php vendor/bin/composer-dependency-analyser",
100+
"lint-doctrine": "@php tests/Application/bin/console.php doctrine:schema:validate --skip-sync --env test",
101+
"lint-container": "@php tests/Application/bin/console.php lint:container --env test",
102+
"lint-yaml": "@php tests/Application/bin/console.php lint:yaml tests/Application/config --env test"
103+
},
104+
"config": {
105+
"allow-plugins": {
106+
"php-http/discovery": true
107+
}
108+
}
109+
}

0 commit comments

Comments
 (0)