From 3326732c47c9bbf80077d73bd1e0dc7de5d04b19 Mon Sep 17 00:00:00 2001 From: Stefan Hagspiel Date: Thu, 11 Dec 2025 22:22:25 +0100 Subject: [PATCH 1/3] adjust test setup --- .gitattributes | 5 +- .github/ci/files/bin/console | 48 +++------ .github/ci/files/config/bundles.php | 2 +- .../ci/files/config/packages/security.yaml | 15 +-- .../ci/files/config/packages/test/config.yaml | 5 - .github/ci/files/config/services.yaml | 40 -------- .github/ci/files/kernel/Kernel.php | 12 +-- .github/ci/files/public/index_test.php | 42 +++----- .github/ci/files/security.yaml | 32 ------ .../ci/scripts/setup-opendxp-environment.sh | 11 +-- .github/workflows/codeception.yml | 62 ++++++------ .github/workflows/php-cs-fixer.yaml | 6 +- .github/workflows/static-analysis.yml | 68 ++++++------- .php-cs-fixer-finder.dist.php | 11 +++ .php-cs-fixer.dist.php | 79 --------------- composer.json | 99 +++++++++---------- tests/bin/docker-compose.yml | 4 +- 17 files changed, 162 insertions(+), 379 deletions(-) delete mode 100644 .github/ci/files/security.yaml create mode 100644 .php-cs-fixer-finder.dist.php delete mode 100644 .php-cs-fixer.dist.php diff --git a/.gitattributes b/.gitattributes index d8efbbf..66f648a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,15 +1,12 @@ - * -text - -# Exclude build/test files from archive to reduce ZIP size for composer dist download /.github export-ignore /tests export-ignore /.editorconfig export-ignore /.gitattributes export-ignore /.gitignore export-ignore /.markdownlint.json export-ignore -/.php-cs-fixer.dist.php export-ignore +/.php-cs-fixer-finder.dist.php export-ignore /CLA.md export-ignore /CONTRIBUTING.md export-ignore /codeception.dist.yml export-ignore diff --git a/.github/ci/files/bin/console b/.github/ci/files/bin/console index 04d2610..de28d8f 100644 --- a/.github/ci/files/bin/console +++ b/.github/ci/files/bin/console @@ -1,47 +1,29 @@ #!/usr/bin/env php getParameterOption(['--env', '-e'], null, true)) { - putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); - } +return static function () { - if ($input->hasParameterOption('--no-debug', true)) { - putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); - } + $kernel = Bootstrap::startupCli(); - /** @var \Pimcore\Kernel $kernel */ - $kernel = \OpenDxp\Bootstrap::startupCli(); - $application = new \OpenDxp\Console\Application($kernel); - $application->run(); - return $application; -}; + return new Application($kernel); +}; \ No newline at end of file diff --git a/.github/ci/files/config/bundles.php b/.github/ci/files/config/bundles.php index 32dd76b..3ba8cdd 100644 --- a/.github/ci/files/config/bundles.php +++ b/.github/ci/files/config/bundles.php @@ -1,6 +1,6 @@ ['all' => true], + \OpenDxp\Bundle\AdminBundle\OpenDxpAdminBundle::class => ['all' => true], \OpenDxp\Bundle\DataHubBundle\OpenDxpDataHubBundle::class => ['all' => true] ]; diff --git a/.github/ci/files/config/packages/security.yaml b/.github/ci/files/config/packages/security.yaml index 4477779..c2f2cf5 100644 --- a/.github/ci/files/config/packages/security.yaml +++ b/.github/ci/files/config/packages/security.yaml @@ -2,30 +2,19 @@ security: providers: opendxp_admin: id: OpenDxp\Security\User\UserProvider - firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false - - # Pimcore WebDAV HTTP basic // DO NOT CHANGE! - opendxp_webdav: - pattern: ^/asset/webdav + opendxp_admin_webdav: + pattern: ^/admin/asset/webdav provider: opendxp_admin http_basic: ~ - opendxp_admin: '%opendxp_admin_bundle.firewall_settings%' - access_control: - # Pimcore admin ACl // DO NOT CHANGE! - { path: ^/admin/settings/display-custom-logo, roles: PUBLIC_ACCESS } - - { path: ^/admin/login/2fa-verify, roles: IS_AUTHENTICATED_2FA_IN_PROGRESS } - - { path: ^/admin/login/2fa-setup, roles: ROLE_OPENDXP_USER } - - { path: ^/admin/login/2fa, roles: IS_AUTHENTICATED_2FA_IN_PROGRESS } - { path: ^/admin/login$, roles: PUBLIC_ACCESS } - { path: ^/admin/login/(login|lostpassword|deeplink|csrf-token)$, roles: PUBLIC_ACCESS } - { path: ^/admin, roles: ROLE_OPENDXP_USER } - role_hierarchy: - # Pimcore admin // DO NOT CHANGE! ROLE_OPENDXP_ADMIN: [ROLE_OPENDXP_USER] diff --git a/.github/ci/files/config/packages/test/config.yaml b/.github/ci/files/config/packages/test/config.yaml index dc973cd..8bc5fff 100644 --- a/.github/ci/files/config/packages/test/config.yaml +++ b/.github/ci/files/config/packages/test/config.yaml @@ -17,11 +17,6 @@ doctrine: connections: default: url: '%opendxp_test.db.dsn%' - host: ~ - port: ~ - dbname: ~ - user: ~ - password: ~ mapping_types: enum: string bit: boolean diff --git a/.github/ci/files/config/services.yaml b/.github/ci/files/config/services.yaml index 033a7cb..7b891d0 100644 --- a/.github/ci/files/config/services.yaml +++ b/.github/ci/files/config/services.yaml @@ -1,52 +1,12 @@ parameters: secret: ThisTokenIsNotSoSecretChangeIt - # customize the full path to external executables - # normally they are auto-detected by `which program` or auto-discovered in the configured path in - # System Settings -> General -> Additional $PATH variable - # but in general it's a good idea to have your programs in your $PATH environment variable (system wide) - - #pimcore_executable_composer: php /opt/vendor/bin/composer.phar - #pimcore_executable_soffice: /opt/libreoffice/bin/soffice - #pimcore_executable_gs: /opt/ghostscript/bin/gs - #pimcore_executable_pdftotext: /opt/tools/pdftotext - #pimcore_executable_xvfb-run: /opt/tools/xvfb-run - #pimcore_executable_pngcrush: /opt/tools/pngcrush - #pimcore_executable_zopflipng: /opt/tools/zopflipng - #pimcore_executable_pngout: /opt/tools/pngout - #pimcore_executable_advpng: /opt/tools/advpng - #pimcore_executable_cjpeg: /opt/tools/cjpeg - #pimcore_executable_jpegoptim: /opt/tools/jpegoptim - #pimcore_executable_php: /usr/local/custom-php/bin/php - #pimcore_executable_nice: /opt/tools/nice - #pimcore_executable_nohup: /opt/tools/nohup - #pimcore_executable_ffmpeg: /opt/tools/ffmpeg - #pimcore_executable_exiftool: /opt/tools/exiftool - services: - # default configuration for services in *this* file _defaults: - # automatically injects dependencies in your services autowire: true - # automatically registers your services as commands, event subscribers, etc. autoconfigure: true - # this means you cannot fetch services directly from the container via $container->get() - # if you need to do this, you can override this setting on individual services public: true - # Example custom templating helper - # AppBundle\Templating\Helper\Example: - # # templating helpers need to be public as they - # # are fetched from the container on demand - # public: true - # tags: - # - { name: templating.helper, alias: fooBar } - - # Example event listener for objects - # AppBundle\EventListener\TestListener: - # tags: - # - { name: kernel.event_listener, event: pimcore.dataobject.preUpdate, method: onObjectPreUpdate } - OpenDxp\Bundle\DataHubBundle\Installer: public: true arguments: diff --git a/.github/ci/files/kernel/Kernel.php b/.github/ci/files/kernel/Kernel.php index 8521d8d..427cd5e 100644 --- a/.github/ci/files/kernel/Kernel.php +++ b/.github/ci/files/kernel/Kernel.php @@ -1,15 +1,15 @@ handle($request); - $response->send(); + Bootstrap::bootstrap(); - $kernel->terminate($request, $response); - return $kernel; + return Bootstrap::kernel(); }; diff --git a/.github/ci/files/security.yaml b/.github/ci/files/security.yaml deleted file mode 100644 index 045b35a..0000000 --- a/.github/ci/files/security.yaml +++ /dev/null @@ -1,32 +0,0 @@ -security: - enable_authenticator_manager: true - - providers: - opendxp_admin: - id: OpenDxp\Security\User\UserProvider - - firewalls: - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - # Pimcore WebDAV HTTP basic // DO NOT CHANGE! - opendxp_webdav: - pattern: ^/asset/webdav - provider: opendxp_admin - http_basic: ~ - - access_control: - # Pimcore admin ACl // DO NOT CHANGE! - - { path: ^/admin/settings/display-custom-logo, roles: PUBLIC_ACCESS } - - { path: ^/admin/login/2fa-verify, roles: IS_AUTHENTICATED_2FA_IN_PROGRESS } - - { path: ^/admin/login/2fa-setup, roles: ROLE_OPENDXP_USER } - - { path: ^/admin/login/2fa, roles: IS_AUTHENTICATED_2FA_IN_PROGRESS } - - { path: ^/admin/login$, roles: PUBLIC_ACCESS } - - { path: ^/admin/login/(login|lostpassword|deeplink|csrf-token)$, roles: PUBLIC_ACCESS } - - { path: ^/admin, roles: ROLE_OPENDXP_USER } - - { path: ^/asset/webdav, roles: ROLE_OPENDXP_USER } - - role_hierarchy: - # Pimcore admin // DO NOT CHANGE! - ROLE_OPENDXP_ADMIN: [ROLE_OPENDXP_USER] diff --git a/.github/ci/scripts/setup-opendxp-environment.sh b/.github/ci/scripts/setup-opendxp-environment.sh index 2c019a4..79cc441 100755 --- a/.github/ci/scripts/setup-opendxp-environment.sh +++ b/.github/ci/scripts/setup-opendxp-environment.sh @@ -5,18 +5,11 @@ set -eu mkdir -p var/config mkdir -p bin -cp .github/ci/files/.env . cp -r .github/ci/files/config/. config cp -r .github/ci/files/templates/. templates cp -r .github/ci/files/bin/console bin/console -chmod 755 bin/console cp -r .github/ci/files/kernel/. kernel cp -r .github/ci/files/public/. public +cp .github/ci/files/.env ./ -if [ ${REQUIRE_ADMIN_BUNDLE} = true ]; then - composer require -n --no-update open-dxp/admin-bundle:^1.0 -else - ## Todo Remove when dropping support for Pimcore 10 - rm config/packages/security.yaml - cp .github/ci/files/security.yaml config/packages -fi +chmod 755 bin/console \ No newline at end of file diff --git a/.github/workflows/codeception.yml b/.github/workflows/codeception.yml index c1a53b5..12dad78 100644 --- a/.github/workflows/codeception.yml +++ b/.github/workflows/codeception.yml @@ -6,9 +6,12 @@ on: branches: - "[0-9]+.[0-9]+" - "[0-9]+.x" - - "feature-*" + paths-ignore: + - 'doc/**' pull_request: types: [ opened, synchronize, reopened ] + paths-ignore: + - 'doc/**' env: OPENDXP_PROJECT_ROOT: ${{ github.workspace }} @@ -36,13 +39,10 @@ jobs: if [ -f composer.json ]; then php_versions=$(jq -r '.require.php' composer.json | grep -oP '\d+\.\d+' | tr '\n' ',' | sed 's/,$//') if [ -z "$php_versions" ]; then - echo "No PHP versions found in composer.json" - echo "Setting default PHP value" - echo "php_versions=default" >> $GITHUB_OUTPUT - else - echo "php_versions=$php_versions" >> $GITHUB_OUTPUT - echo "#### php versions #### : $php_versions" + echo "No PHP versions found in composer.json, using default" + php_versions="default" fi + echo "php_versions=$php_versions" >> $GITHUB_OUTPUT else echo "composer.json not found" exit 1 @@ -51,24 +51,14 @@ jobs: - name: Set up matrix id: set-matrix run: | - php_versions="${{ steps.parse-php-versions.outputs.php_versions }}" - - MATRIX_JSON=$(cat reusable-workflows/codeception-tests-configuration/matrix-config.json) - - IFS=',' read -ra VERSIONS_ARRAY <<< "$php_versions" - - FILTERED_MATRIX_JSON=$(echo $MATRIX_JSON | jq --arg php_versions "$php_versions" ' - { - matrix: [ - .configs[] | - select(.php_version == $php_versions) | - .matrix[] - ] - }') - - ENCODED_MATRIX_JSON=$(echo $FILTERED_MATRIX_JSON | jq -c .) - - echo "matrix=${ENCODED_MATRIX_JSON}" >> $GITHUB_OUTPUT + + php_versions="${{ steps.parse-php-versions.outputs.php_versions }}" + + matrix_json=$(jq -c --arg php_versions "$php_versions" \ + '{matrix: [.configs[] | select(.php_version == $php_versions) | .matrix[]]}' \ + reusable-workflows/codeception-tests-configuration/matrix-config.json) + + echo "matrix=${matrix_json}" >> $GITHUB_OUTPUT codeception-tests: needs: setup-matrix @@ -76,14 +66,18 @@ jobs: matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} uses: open-dxp/workflows-collection-public/.github/workflows/reusable-codeception-tests-centralized.yaml@main with: - APP_ENV: test - OPENDXP_TEST: 1 - PHP_VERSION: ${{ matrix.matrix.php-version }} - DATABASE: ${{ matrix.matrix.database }} - SERVER_VERSION: ${{ matrix.matrix.server_version }} - DEPENDENCIES: ${{ matrix.matrix.dependencies }} - EXPERIMENTAL: ${{ matrix.matrix.experimental }} - OPENDXP_VERSION: ${{ matrix.matrix.opendxp_version }} + app_env: test + opendxp_test: 1 + php_version: ${{ matrix.matrix.php-version }} + database: ${{ matrix.matrix.database }} + server_version: ${{ matrix.matrix.server_version }} + dependencies: ${{ matrix.matrix.dependencies }} + experimental: ${{ matrix.matrix.experimental }} + opendxp_version: ${{ matrix.matrix.opendxp_version }} + opendxp_admin_version: ${{ matrix.matrix.opendxp_admin_version }} + composer_options: ${{ matrix.matrix.composer_options }} + composer_root_version: ${{ matrix.matrix.composer_root_version }} secrets: + CLA_ACTION_ACCESS_TOKEN: ${{ secrets.CLA_ACTION_ACCESS_TOKEN }} SSH_PRIVATE_KEY_OPENDXP_DEPLOYMENTS_USER: ${{ secrets.SSH_PRIVATE_KEY_OPENDXP_DEPLOYMENTS_USER }} - COMPOSER_OPENDXP_REPO_PACKAGIST_TOKEN: ${{ secrets.COMPOSER_OPENDXP_REPO_PACKAGIST_TOKEN }} + COMPOSER_OPENDXP_REPO_PACKAGIST_TOKEN: ${{ secrets.COMPOSER_OPENDXP_REPO_PACKAGIST_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/php-cs-fixer.yaml b/.github/workflows/php-cs-fixer.yaml index 881d807..f1a1c21 100644 --- a/.github/workflows/php-cs-fixer.yaml +++ b/.github/workflows/php-cs-fixer.yaml @@ -6,8 +6,6 @@ on: branches: - "[0-9]+.[0-9]+" - "[0-9]+.x" - - "*_actions" - - "feature-*" permissions: contents: write @@ -15,9 +13,11 @@ permissions: jobs: php-style: uses: open-dxp/workflows-collection-public/.github/workflows/reusable-php-cs-fixer.yaml@main + if: github.repository_owner == 'open-dxp' secrets: PHP_CS_FIXER_GITHUB_TOKEN: ${{ secrets.PHP_CS_FIXER_GITHUB_TOKEN }} with: head_ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} - config_file: .php-cs-fixer.dist.php \ No newline at end of file + use_global_config: true + finder_file: .php-cs-fixer-finder.dist.php \ No newline at end of file diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index b91c37c..9787fb5 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -1,20 +1,22 @@ name: Static analysis [centralised] on: + workflow_dispatch: schedule: - cron: '0 3 * * 1,3,5' - workflow_dispatch: push: branches: - - "[0-9]+.[0-9]+" - - "[0-9]+.x" - - "feature-*" + - '[0-9]+.[0-9]+' + - '[0-9]+.x' + paths-ignore: + - 'doc/**' pull_request: types: [ opened, synchronize, reopened ] + paths-ignore: + - 'doc/**' env: OPENDXP_PROJECT_ROOT: ${{ github.workspace }} - PRIVATE_REPO: ${{ github.event.repository.private }} jobs: setup-matrix: @@ -22,7 +24,6 @@ jobs: outputs: php_versions: ${{ steps.parse-php-versions.outputs.php_versions }} matrix: ${{ steps.set-matrix.outputs.matrix }} - private_repo: ${{ env.PRIVATE_REPO }} steps: - name: Checkout code uses: actions/checkout@v4 @@ -40,13 +41,10 @@ jobs: if [ -f composer.json ]; then php_versions=$(jq -r '.require.php' composer.json | grep -oP '\d+\.\d+' | tr '\n' ',' | sed 's/,$//') if [ -z "$php_versions" ]; then - echo "No PHP versions found in composer.json" - echo "Setting default PHP value" - echo "php_versions=default" >> $GITHUB_OUTPUT - else - echo "php_versions=$php_versions" >> $GITHUB_OUTPUT - echo "#### php versions #### : $php_versions" + echo "No PHP versions found in composer.json, using default" + php_versions="default" fi + echo "php_versions=$php_versions" >> $GITHUB_OUTPUT else echo "composer.json not found" exit 1 @@ -55,24 +53,14 @@ jobs: - name: Set up matrix id: set-matrix run: | - php_versions="${{ steps.parse-php-versions.outputs.php_versions }}" - - MATRIX_JSON=$(cat reusable-workflows/phpstan-configuration/matrix-config.json) - - IFS=',' read -ra VERSIONS_ARRAY <<< "$php_versions" - - FILTERED_MATRIX_JSON=$(echo $MATRIX_JSON | jq --arg php_versions "$php_versions" ' - { - matrix: [ - .configs[] | - select(.php_version == $php_versions) | - .matrix[] - ] - }') - - ENCODED_MATRIX_JSON=$(echo $FILTERED_MATRIX_JSON | jq -c .) - - echo "matrix=${ENCODED_MATRIX_JSON}" >> $GITHUB_OUTPUT + + php_versions="${{ steps.parse-php-versions.outputs.php_versions }}" + + matrix_json=$(jq -c --arg php_versions "$php_versions" \ + '{matrix: [.configs[] | select(.php_version == $php_versions) | .matrix[]]}' \ + reusable-workflows/phpstan-configuration/matrix-config.json) + + echo "matrix=${matrix_json}" >> $GITHUB_OUTPUT static-analysis: needs: setup-matrix @@ -80,12 +68,14 @@ jobs: matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} uses: open-dxp/workflows-collection-public/.github/workflows/reusable-static-analysis-centralized.yaml@main with: - APP_ENV: test - OPENDXP_TEST: 1 - PRIVATE_REPO: ${{ needs.setup-matrix.outputs.private_repo}} - PHP_VERSION: ${{ matrix.matrix.php-version }} - SYMFONY: ${{ matrix.matrix.symfony }} - DEPENDENCIES: ${{ matrix.matrix.dependencies }} - EXPERIMENTAL: ${{ matrix.matrix.experimental }} - OPENDXP_VERSION: ${{ matrix.matrix.opendxp_version }} - COMPOSER_OPTIONS: ${{ matrix.matrix.composer_options }} + app_env: test + opendxp_test: 1 + php_version: ${{ matrix.matrix.php-version }} + symfony: ${{ matrix.matrix.symfony }} + dependencies: ${{ matrix.matrix.dependencies }} + experimental: ${{ matrix.matrix.experimental }} + opendxp_version: ${{ matrix.matrix.opendxp_version }} + opendxp_admin_version: ${{ matrix.matrix.opendxp_admin_version }} + composer_options: ${{ matrix.matrix.composer_options }} + composer_root_version: ${{ matrix.matrix.composer_root_version }} + cache_clear: true diff --git a/.php-cs-fixer-finder.dist.php b/.php-cs-fixer-finder.dist.php new file mode 100644 index 0000000..7b7d36b --- /dev/null +++ b/.php-cs-fixer-finder.dist.php @@ -0,0 +1,11 @@ +in([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]) + ->exclude([ + __DIR__ . '/tests/_output', + __DIR__ . '/tests/Support/_generated', + ]); \ No newline at end of file diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php deleted file mode 100644 index ed64acb..0000000 --- a/.php-cs-fixer.dist.php +++ /dev/null @@ -1,79 +0,0 @@ -in([ - __DIR__ . '/src', - __DIR__ . '/tests', - ]) - - ->exclude([ - __DIR__ . '/tests/_output', - __DIR__ . '/tests/_support/_generated', - ]) -; - -// do not enable self_accessor as it breaks opendxp models relying on get_called_class() -$config = new PhpCsFixer\Config(); -$config->setRules([ - '@PSR1' => true, - '@PSR2' => true, - 'array_syntax' => ['syntax' => 'short'], - 'list_syntax' => ['syntax' => 'short'], - - 'header_comment' => [ - 'comment_type' => 'PHPDoc', - 'header' => 'OpenDXP' . PHP_EOL - . PHP_EOL . - 'This source file is licensed under the GNU General Public License version 3 (GPLv3).' . PHP_EOL - . PHP_EOL . - 'Full copyright and license information is available in' . PHP_EOL . - 'LICENSE.md which is distributed with this source code.' . PHP_EOL - . PHP_EOL . - '@copyright Copyright (c) Pimcore GmbH (https://pimcore.com)' . PHP_EOL . - '@copyright Modification Copyright (c) OpenDXP (https://www.opendxp.ch)' . PHP_EOL . - '@license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)' - ], - 'blank_line_before_statement' => true, - 'encoding' => true, - 'function_typehint_space' => true, - 'single_line_comment_style' => true, - 'lowercase_cast' => true, - 'magic_constant_casing' => true, - 'method_argument_space' => ['on_multiline' => 'ignore'], - 'class_attributes_separation' => true, - 'native_function_casing' => true, - 'no_blank_lines_after_class_opening' => true, - 'no_blank_lines_after_phpdoc' => true, - 'no_empty_comment' => true, - 'no_empty_phpdoc' => true, - 'no_empty_statement' => true, - 'no_extra_blank_lines' => true, - 'no_leading_import_slash' => true, - 'no_leading_namespace_whitespace' => true, - 'no_short_bool_cast' => true, - 'no_spaces_around_offset' => true, - 'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'remove_inheritdoc' => true], - 'no_unneeded_control_parentheses' => true, - 'no_unused_imports' => true, - 'no_whitespace_before_comma_in_array' => true, - 'no_whitespace_in_blank_line' => true, - 'object_operator_without_whitespace' => true, - 'ordered_imports' => true, - 'phpdoc_indent' => true, - 'phpdoc_no_useless_inheritdoc' => true, - 'phpdoc_scalar' => true, - 'phpdoc_separation' => true, - 'phpdoc_single_line_var_spacing' => true, - 'return_type_declaration' => true, - 'short_scalar_cast' => true, - 'single_blank_line_before_namespace' => true, - 'single_quote' => true, - 'space_after_semicolon' => true, - 'standardize_not_equals' => true, - 'ternary_operator_spaces' => true, - 'trailing_comma_in_multiline' => true, - 'whitespace_after_comma_in_array' => true, -]); - -$config->setFinder($finder); -return $config; diff --git a/composer.json b/composer.json index de2cd73..379a8a7 100644 --- a/composer.json +++ b/composer.json @@ -1,56 +1,53 @@ { - "name": "open-dxp/data-hub-bundle", - "license": "GPL-3.0+", - "type": "opendxp-bundle", - "description": "OpenDXP Datahub", - "config": { - "sort-packages": true, - "preferred-install": { - "open-dxp/opendxp": "source", - "*": "dist" + "name": "open-dxp/data-hub-bundle", + "license": "GPL-3.0+", + "type": "opendxp-bundle", + "description": "OpenDXP Datahub", + "config": { + "sort-packages": true, + "preferred-install": { + "open-dxp/opendxp": "source", + "*": "dist" + }, + "allow-plugins": { + "symfony/runtime": true + } }, - "allow-plugins": { - "symfony/runtime": true - } - }, - "prefer-stable": true, - "minimum-stability": "dev", - "require": { - "php": "~8.3.0 || ~8.4.0", - "open-dxp/admin-bundle": "^1.0", - "open-dxp/opendxp": "^1.1", - "webonyx/graphql-php": "^15.2.3" - }, - "require-dev": { - "phpstan/phpstan": "^2.0", - "phpunit/phpunit": "^9.6", - "symfony/phpunit-bridge": "^6", - "codeception/codeception": "^5.0.3", - "codeception/phpunit-wrapper": "^9", - "codeception/module-asserts": "^2", - "codeception/module-symfony": "^3.1.0", - "symfony/dotenv": "^7.3", - "symfony/runtime": "^7.3" - }, - "autoload": { - "psr-4": { - "OpenDxp\\Bundle\\DataHubBundle\\": "src/", - "OpenDxp\\": "core-extension/OpenDxp/" - } - }, - "autoload-dev": { - "psr-4": { - "OpenDxp\\Bundle\\DataHubBundle\\Tests\\": "tests" + "require": { + "php": "~8.3.0 || ~8.4.0", + "open-dxp/opendxp": "^1.1", + "webonyx/graphql-php": "^15.2.3" + }, + "require-dev": { + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^9.6", + "symfony/phpunit-bridge": "^6", + "codeception/codeception": "^5.0.3", + "codeception/phpunit-wrapper": "^9", + "codeception/module-asserts": "^2", + "codeception/module-symfony": "^3.1.0", + "symfony/dotenv": "^7.3", + "symfony/runtime": "^7.3" + }, + "autoload": { + "psr-4": { + "OpenDxp\\Bundle\\DataHubBundle\\": "src/", + "OpenDxp\\": "core-extension/OpenDxp/" + } + }, + "autoload-dev": { + "psr-4": { + "OpenDxp\\Bundle\\DataHubBundle\\Tests\\": "tests" + }, + "files": [ + "kernel/Kernel.php" + ] }, - "files": [ - "kernel/Kernel.php" - ] - }, - "extra": { - "opendxp": { - "bundles": [ - "OpenDxp\\Bundle\\DataHubBundle\\OpenDxpDataHubBundle" - ] + "extra": { + "opendxp": { + "bundles": [ + "OpenDxp\\Bundle\\DataHubBundle\\OpenDxpDataHubBundle" + ] + } } - } } diff --git a/tests/bin/docker-compose.yml b/tests/bin/docker-compose.yml index ca86062..8fce122 100644 --- a/tests/bin/docker-compose.yml +++ b/tests/bin/docker-compose.yml @@ -12,8 +12,8 @@ services: php: #user: '1000:1000' # set to your uid:gid - #image: open-dxp/opendxp:PHP8.1-fpm-debug - image: open-dxp/opendxp:PHP8.1-fpm + #image: opendxp/opendxp:php8.4-debug-latest + image: opendxp/opendxp:php8.4-latest environment: PHP_IDE_CONFIG: "serverName=localhost" COMPOSER_HOME: /var/www/html From 177eae6ff1e335c038c8b10b740cfd818333bc7f Mon Sep 17 00:00:00 2001 From: Stefan Hagspiel Date: Thu, 11 Dec 2025 22:31:35 +0100 Subject: [PATCH 2/3] adjust test docker compose config --- tests/bin/docker-compose.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/bin/docker-compose.yml b/tests/bin/docker-compose.yml index 8fce122..2853855 100644 --- a/tests/bin/docker-compose.yml +++ b/tests/bin/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3.0' services: db: image: mariadb:10.7 @@ -11,8 +10,8 @@ services: MYSQL_PASSWORD: opendxp php: - #user: '1000:1000' # set to your uid:gid - #image: opendxp/opendxp:php8.4-debug-latest + # user: '1000:1000' # set to your uid:gid + # image: opendxp/opendxp:php8.4-debug-latest image: opendxp/opendxp:php8.4-latest environment: PHP_IDE_CONFIG: "serverName=localhost" From ef8fcf3738ef4b704f6b2fb0e4333f5482526fd6 Mon Sep 17 00:00:00 2001 From: Stefan Hagspiel Date: Fri, 12 Dec 2025 21:10:51 +0100 Subject: [PATCH 3/3] adjust test setup --- .github/ci/files/config/bundles.php | 4 +- .github/ci/files/config/config.yaml | 75 ++++++++- .../ci/files/config/packages/test/config.yaml | 26 --- .../ci/files/config/routes/test/routes.yaml | 2 + .github/ci/files/config/services.yaml | 13 -- .github/ci/files/config/system.yml | 57 ------- .github/ci/files/public/.htaccess | 155 ------------------ .../public/{index_test.php => index.php} | 0 8 files changed, 76 insertions(+), 256 deletions(-) create mode 100755 .github/ci/files/config/routes/test/routes.yaml delete mode 100644 .github/ci/files/config/services.yaml delete mode 100644 .github/ci/files/config/system.yml delete mode 100644 .github/ci/files/public/.htaccess rename .github/ci/files/public/{index_test.php => index.php} (100%) diff --git a/.github/ci/files/config/bundles.php b/.github/ci/files/config/bundles.php index 3ba8cdd..f77df12 100644 --- a/.github/ci/files/config/bundles.php +++ b/.github/ci/files/config/bundles.php @@ -1,6 +1,6 @@ ['all' => true], - \OpenDxp\Bundle\DataHubBundle\OpenDxpDataHubBundle::class => ['all' => true] + OpenDxp\Bundle\AdminBundle\OpenDxpAdminBundle::class => ['all' => true], + OpenDxp\Bundle\DataHubBundle\OpenDxpDataHubBundle::class => ['all' => true] ]; diff --git a/.github/ci/files/config/config.yaml b/.github/ci/files/config/config.yaml index 2c6f250..c150cd3 100644 --- a/.github/ci/files/config/config.yaml +++ b/.github/ci/files/config/config.yaml @@ -1,9 +1,78 @@ -imports: - - { resource: services.yaml } - - { resource: system.yml } +parameters: + secret: ThisTokenIsNotSoSecretChangeIt + opendxp_test.db.dsn: '%env(OPENDXP_TEST_DB_DSN)%' + env(OPENDXP_TEST_DB_DSN): ~ + opendxp.encryption.secret: 'def00000fc1e34a17a03e2ef85329325b0736a5941633f8062f6b0a1a20f416751af119256bea0abf83ac33ef656b3fff087e1ce71fa6b8810d7f854fe2781f3fe4507f6' + +doctrine: + dbal: + connections: + default: + url: '%opendxp_test.db.dsn%' + mapping_types: + enum: string + bit: boolean opendxp_data_hub: config_location: data_hub: write_target: type: 'settings-store' + +opendxp: + general: + timezone: Europe/Berlin + path_variable: '' + domain: opendxp-test.dev + redirect_to_maindomain: false + valid_languages: 'en,de' + fallback_languages: + en: '' + de: '' + default_language: '' + disable_usage_statistics: false + documents: + versions: + days: null + steps: 10 + error_pages: + default: /error + allow_trailing_slash: 'no' + generate_preview: true + objects: + versions: + days: null + steps: 10 + assets: + versions: + days: null + steps: 10 + icc_rgb_profile: '' + icc_cmyk_profile: '' + full_page_cache: + enabled: false + lifetime: null + exclude_patterns: '' + exclude_cookie: '' + httpclient: + adapter: Socket + proxy_host: '' + proxy_port: '' + proxy_user: '' + proxy_pass: '' + email: + sender: + name: opendxp + email: opendxp@example.com + return: + name: opendxp + email: opendxp@example.com + debug: + email_addresses: '' + applicationlog: + mail_notification: + send_log_summary: false + filter_priority: null + mail_receiver: '' + archive_treshold: '30' + archive_alternative_database: '' diff --git a/.github/ci/files/config/packages/test/config.yaml b/.github/ci/files/config/packages/test/config.yaml index 8bc5fff..d77183c 100644 --- a/.github/ci/files/config/packages/test/config.yaml +++ b/.github/ci/files/config/packages/test/config.yaml @@ -1,28 +1,2 @@ imports: - { resource: ../../config.yaml } - -# this cache is used during tests when setting up pimcore -framework: - cache: - pools: - opendxp.cache.pool: - public: true - tags: true - default_lifetime: 31536000 # 1 year - adapter: cache.adapter.array - - -doctrine: - dbal: - connections: - default: - url: '%opendxp_test.db.dsn%' - mapping_types: - enum: string - bit: boolean - - -parameters: - opendxp_test.db.dsn: '%env(OPENDXP_TEST_DB_DSN)%' - env(OPENDXP_TEST_DB_DSN): ~ - opendxp.encryption.secret: 'def00000fc1e34a17a03e2ef85329325b0736a5941633f8062f6b0a1a20f416751af119256bea0abf83ac33ef656b3fff087e1ce71fa6b8810d7f854fe2781f3fe4507f6' diff --git a/.github/ci/files/config/routes/test/routes.yaml b/.github/ci/files/config/routes/test/routes.yaml new file mode 100755 index 0000000..4c18a90 --- /dev/null +++ b/.github/ci/files/config/routes/test/routes.yaml @@ -0,0 +1,2 @@ +_opendxp: + resource: '@OpenDxpCoreBundle/config/routing.yaml' diff --git a/.github/ci/files/config/services.yaml b/.github/ci/files/config/services.yaml deleted file mode 100644 index 7b891d0..0000000 --- a/.github/ci/files/config/services.yaml +++ /dev/null @@ -1,13 +0,0 @@ -parameters: - secret: ThisTokenIsNotSoSecretChangeIt - -services: - _defaults: - autowire: true - autoconfigure: true - public: true - - OpenDxp\Bundle\DataHubBundle\Installer: - public: true - arguments: - $bundle: "@=service('kernel').getBundle('OpenDxpDataHubBundle')" diff --git a/.github/ci/files/config/system.yml b/.github/ci/files/config/system.yml deleted file mode 100644 index 7024eaf..0000000 --- a/.github/ci/files/config/system.yml +++ /dev/null @@ -1,57 +0,0 @@ -opendxp: - general: - timezone: Europe/Berlin - path_variable: '' - domain: opendxp-test.dev - redirect_to_maindomain: false - valid_languages: 'en,de' - fallback_languages: - en: '' - de: '' - default_language: '' - disable_usage_statistics: false - documents: - versions: - days: null - steps: 10 - error_pages: - default: /error - allow_trailing_slash: 'no' - generate_preview: true - objects: - versions: - days: null - steps: 10 - assets: - versions: - days: null - steps: 10 - icc_rgb_profile: '' - icc_cmyk_profile: '' - full_page_cache: - enabled: false - lifetime: null - exclude_patterns: '' - exclude_cookie: '' - httpclient: - adapter: Socket - proxy_host: '' - proxy_port: '' - proxy_user: '' - proxy_pass: '' - email: - sender: - name: opendxp - email: opendxp@example.com - return: - name: opendxp - email: opendxp@example.com - debug: - email_addresses: '' - applicationlog: - mail_notification: - send_log_summary: false - filter_priority: null - mail_receiver: '' - archive_treshold: '30' - archive_alternative_database: '' diff --git a/.github/ci/files/public/.htaccess b/.github/ci/files/public/.htaccess deleted file mode 100644 index 5475587..0000000 --- a/.github/ci/files/public/.htaccess +++ /dev/null @@ -1,155 +0,0 @@ -# Use the front controller as index file. It serves as a fallback solution when -# every other rewrite/redirect fails (e.g. in an aliased environment without -# mod_rewrite). Additionally, this reduces the matching process for the -# start page (path "/") because otherwise Apache will apply the rewriting rules -# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl). -DirectoryIndex index_test.php - -# By default, Apache does not evaluate symbolic links if you did not enable this -# feature in your server configuration. Uncomment the following line if you -# install assets as symlinks or if you experience problems related to symlinks -# when compiling LESS/Sass/CoffeScript assets. -# Options FollowSymlinks - -# Disabling MultiViews prevents unwanted negotiation, e.g. "/app" should not resolve -# to the front controller "/app.php" but be rewritten to "/app.php/app". - - Options -MultiViews - - -# mime types -AddType video/mp4 .mp4 -AddType video/webm .webm -AddType image/jpeg .pjpeg - -Options +SymLinksIfOwnerMatch - -# Use UTF-8 encoding for anything served text/plain or text/html -AddDefaultCharset utf-8 - -RewriteEngine On - - - - Header always unset X-Content-Type-Options - - - -# Determine the RewriteBase automatically and set it as environment variable. -# If you are using Apache aliases to do mass virtual hosting or installed the -# project in a subdirectory, the base path will be prepended to allow proper -# resolution of the app.php file and to redirect to the correct URI. It will -# work in environments without path prefix as well, providing a safe, one-size -# fits all solution. But as you do not need it in this case, you can comment -# the following 2 lines to eliminate the overhead. -RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ -RewriteRule ^(.*) - [E=BASE:%1] - -# Sets the HTTP_AUTHORIZATION header removed by Apache -RewriteCond %{HTTP:Authorization} . -RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] - -# Redirect to URI without front controller to prevent duplicate content -# (with and without `/app.php`). Only do this redirect on the initial -# rewrite by Apache and not on subsequent cycles. Otherwise we would get an -# endless redirect loop (request -> rewrite to front controller -> -# redirect -> request -> ...). -# So in case you get a "too many redirects" error or you always get redirected -# to the start page because your Apache does not expose the REDIRECT_STATUS -# environment variable, you have 2 choices: -# - disable this feature by commenting the following 2 lines or -# - use Apache >= 2.3.9 and replace all L flags by END flags and remove the -# following RewriteCond (best solution) -RewriteCond %{ENV:REDIRECT_STATUS} ^$ -RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L] - - - RewriteCond %{REQUEST_URI} ^/(fpm|server)-(info|status|ping) - RewriteRule . - [L] - - -# restrict access to dotfiles -RewriteCond %{REQUEST_FILENAME} -d [OR] -RewriteCond %{REQUEST_FILENAME} -l [OR] -RewriteCond %{REQUEST_FILENAME} -f -RewriteRule /\.|^\.(?!well-known/) - [F,L] - -# ASSETS: check if request method is GET (because of WebDAV) and if the requested file (asset) exists on the filesystem, if both match, deliver the asset directly -RewriteCond %{REQUEST_METHOD} ^(GET|HEAD) -RewriteCond %{DOCUMENT_ROOT}/var/assets%{REQUEST_URI} -f -RewriteRule ^(.*)$ /var/assets%{REQUEST_URI} [PT,L] - -# Thumbnails -RewriteCond %{REQUEST_URI} .*/(image|video)-thumb__[\d]+__.* -RewriteCond %{DOCUMENT_ROOT}/var/tmp/%1-thumbnails%{REQUEST_URI} -f -RewriteRule ^(.*)$ /var/tmp/%1-thumbnails%{REQUEST_URI} [PT,L] - -# cache-buster rule for scripts & stylesheets embedded using view helpers -RewriteRule ^cache-buster\-[\d]+/(.*) $1 [PT,L] - -# If the requested filename exists, simply serve it. -# We only want to let Apache serve files and not directories. -RewriteCond %{REQUEST_FILENAME} -f -RewriteRule ^ - [L] - -# Rewrite all other queries to the front controller. -RewriteRule ^ %{ENV:BASE}/index_test.php [L] - - - - -########################################## -### OPTIONAL PERFORMANCE OPTIMIZATIONS ### -########################################## - - - # Force compression for mangled headers. - # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping - - - SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding - RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding - - - - # Compress all output labeled with one of the following MIME-types - # (for Apache versions below 2.3.7, you don't need to enable `mod_filter` - # and can remove the `` and `` lines - # as `AddOutputFilterByType` is still in the core directives). - - AddOutputFilterByType DEFLATE application/atom+xml application/javascript application/json \ - application/vnd.ms-fontobject application/x-font-ttf application/rss+xml \ - application/x-web-app-manifest+json application/xhtml+xml \ - application/xml font/opentype image/svg+xml image/x-icon \ - text/css text/html text/plain text/x-component text/xml text/javascript - - - - - ExpiresActive on - ExpiresDefault "access plus 31536000 seconds" - - # specific overrides - #ExpiresByType text/css "access plus 1 year" - - - - # opendxp mod_pagespeed integration - # opendxp automatically disables mod_pagespeed in the following situations: debug-mode on, /admin, preview, editmode, ... - # if you want to disable pagespeed for specific actions in opendxp you can use $this->disableBrowserCache() in your action - RewriteCond %{REQUEST_URI} ^/(mod_)?pagespeed_(statistics|message|console|beacon|admin|global_admin) - RewriteRule . - [L] - - ModPagespeed Off - AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html - ModPagespeedModifyCachingHeaders off - ModPagespeedRewriteLevel PassThrough - # low risk filters - ModPagespeedEnableFilters remove_comments,recompress_images - # low and moderate filters, recommended filters, but can cause problems - ModPagespeedEnableFilters lazyload_images,extend_cache_images,inline_preview_images,sprite_images - ModPagespeedEnableFilters combine_css,rewrite_css,move_css_to_head,flatten_css_imports,extend_cache_css,prioritize_critical_css - ModPagespeedEnableFilters extend_cache_scripts,combine_javascript,canonicalize_javascript_libraries,rewrite_javascript - # high risk - #ModPagespeedEnableFilters defer_javascript,local_storage_cache - diff --git a/.github/ci/files/public/index_test.php b/.github/ci/files/public/index.php similarity index 100% rename from .github/ci/files/public/index_test.php rename to .github/ci/files/public/index.php