diff --git a/.github/workflows/codeception.yml b/.github/workflows/codeception.yml new file mode 100644 index 00000000..d9ad4439 --- /dev/null +++ b/.github/workflows/codeception.yml @@ -0,0 +1,144 @@ +name: Codeception +on: + push: + branches: [ 'master' ] + pull_request: + branches: [ 'master' ] + +jobs: + codeception: + runs-on: ubuntu-latest + env: + TEST_BUNDLE_NAME: "SecureStorageBundle" + TEST_BUNDLE_INSTALLER_CLASS: false + TEST_BUNDLE_TEST_DIR: "${{ github.workspace }}/lib/test-bundle/tests" + TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}" + + PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework" + PIMCORE_CODECEPTION_VERSION: "3.0" + + APP_ENV: test + PIMCORE_TEST_DB_DSN: "mysql://test:test@127.0.0.1:3306/dachcom_bundle_test" + PIMCORE_TEST_URL: "http://localhost" + PIMCORE_CLASS_DIRECTORY: "${{ github.workspace }}/lib/test-bundle/tests/_output/var/classes" + + SYMFONY_DEPRECATIONS_HELPER: "weak" + PIMCORE_PHP_ERROR_REPORTING: 32767 + + WEBDRIVER_HOST: localhost + WEBDRIVER_URL: "http://localhost:8080/" + + services: + mysql: + image: mysql:8.0 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + strategy: + matrix: + php: [ 8.3 ] + symfony: [ ^6.4 ] + pimcore: [ ~11.3.0 ] + include: + - pimcore: ~11.3.0 + template_tag: v2024.2.1 + steps: + - uses: actions/checkout@v2 + with: + path: lib/test-bundle + + - name: Generate Application Structure + run: | + git clone -b ${{ matrix.template_tag }} --single-branch --depth 1 https://github.com/pimcore/skeleton.git + mv skeleton/composer.json . + mv skeleton/bin . + mv skeleton/config . + mv skeleton/public . + mv skeleton/src . + mv skeleton/templates . + mv skeleton/var . + rm -r skeleton + + - name: Setup Pimcore Codeception Framework + env: + MATRIX_PIMCORE_VERSION: ${{ matrix.pimcore }} + MATRIX_PIMCORE_TEMPLATE_TAG: ${{ matrix.template_tag }} + run: | + git clone -b ${{ env.PIMCORE_CODECEPTION_VERSION }} --single-branch --depth 1 https://github.com/dachcom-digital/pimcore-codeception-framework.git + ls -al pimcore-codeception-framework + chmod +x ./pimcore-codeception-framework/src/_etc/scripts/setup.sh + ./pimcore-codeception-framework/src/_etc/scripts/setup.sh + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: intl + coverage: none + + - name: Check PHP Version + run: php -v + + - name: Setup MySql + uses: shogo82148/actions-setup-mysql@v1 + with: + mysql-version: '8.0' + user: test + password: test + root-password: root + auto-start: true + my-cnf: | + max_allowed_packet=32505856 + max_connections=1000 + + - name: Initial Database + run: mysql -utest -ptest -h127.0.0.1 -e 'CREATE DATABASE dachcom_bundle_test CHARSET=utf8mb4;' + + - name: Setup Chromium + run: | + nohup $CHROMEWEBDRIVER/chromedriver --url-base=/wd/hub /dev/null 2>&1 & + + - name: Start Webserver and Chrome + run: | + curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir=$HOME/.symfony/bin + ~/.symfony/bin/symfony server:start --port=8080 --dir=public --allow-http --no-tls --daemon + + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache Composer Downloads + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Composer install + env: + TEST_PIMCORE_VERSION: ${{ matrix.pimcore }} + TEST_SYMFONY_VERSION: ${{ matrix.symfony }} + run: | + chmod +x ./pimcore-codeception-framework/src/_etc/scripts/composer.sh + ./pimcore-codeception-framework/src/_etc/scripts/composer.sh + + - name: Assets Install + run: | + bin/console assets:install public --relative --symlink + + - name: Tests + run: | + bin/console cache:warmup --env=test + vendor/bin/codecept run --env github -c ${{ github.workspace }}/lib/test-bundle + + - name: Log Output + uses: actions/upload-artifact@v2 + if: failure() + with: + name: "Logs (PHP ${{ matrix.php }}, Pimcore ${{ matrix.pimcore }}, Symfony ${{ matrix.symfony }})" + path: ${{ github.workspace }}/lib/test-bundle/tests/_output/ + if-no-files-found: ignore diff --git a/.github/workflows/ecs.yml b/.github/workflows/ecs.yml new file mode 100644 index 00000000..cfc84ade --- /dev/null +++ b/.github/workflows/ecs.yml @@ -0,0 +1,117 @@ +name: Easy Coding Standards +on: + push: + branches: [ 'master' ] + pull_request: + branches: [ 'master' ] + +jobs: + ecs: + runs-on: ubuntu-latest + env: + TEST_BUNDLE_NAME: "SecureStorageBundle" + TEST_BUNDLE_INSTALLER_CLASS: false + TEST_BUNDLE_TEST_DIR: "${{ github.workspace }}/lib/test-bundle/tests" + TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}" + + PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework" + PIMCORE_CODECEPTION_VERSION: "3.0" + + APP_ENV: test + PIMCORE_TEST_DB_DSN: "mysql://root:root@127.0.0.1:3306/dachcom_bundle_test" + PIMCORE_TEST_URL: "http://localhost" + + SYMFONY_DEPRECATIONS_HELPER: "weak" + PIMCORE_PHP_ERROR_REPORTING: 32767 + + WEBDRIVER_HOST: localhost + WEBDRIVER_URL: "http://localhost:8080/" + + services: + mysql: + image: mysql:8.0 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + strategy: + matrix: + php: [ 8.3 ] + symfony: [ ^6.4 ] + pimcore: [ ~11.3.0 ] + include: + - pimcore: ~11.3.0 + template_tag: v2024.2.1 + steps: + - uses: actions/checkout@v2 + with: + path: lib/test-bundle + + - name: Generate Application Structure + run: | + git clone -b ${{ matrix.template_tag }} --single-branch --depth 1 https://github.com/pimcore/skeleton.git + mv skeleton/composer.json . + mv skeleton/bin . + mv skeleton/config . + mv skeleton/public . + mv skeleton/src . + mv skeleton/templates . + mv skeleton/var . + rm -r skeleton + + - name: Setup Pimcore Codeception Framework + env: + MATRIX_PIMCORE_VERSION: ${{ matrix.pimcore }} + MATRIX_PIMCORE_TEMPLATE_TAG: ${{ matrix.template_tag }} + run: | + git clone -b ${{ env.PIMCORE_CODECEPTION_VERSION }} --single-branch --depth 1 https://github.com/dachcom-digital/pimcore-codeception-framework.git + ls -al pimcore-codeception-framework + chmod +x ./pimcore-codeception-framework/src/_etc/scripts/setup.sh + ./pimcore-codeception-framework/src/_etc/scripts/setup.sh + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: intl + coverage: none + + - name: Check PHP Version + run: php -v + + - name: Setup MySql + run: | + sudo systemctl start mysql + mysql -uroot -proot -h127.0.0.1 -e "CREATE DATABASE dachcom_bundle_test CHARSET=utf8mb4;" + + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache Composer Downloads + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Composer install + env: + TEST_PIMCORE_VERSION: ${{ matrix.pimcore }} + TEST_SYMFONY_VERSION: ${{ matrix.symfony }} + run: | + chmod +x ./pimcore-codeception-framework/src/_etc/scripts/composer.sh + ./pimcore-codeception-framework/src/_etc/scripts/composer.sh + + - name: Assets Install + run: | + bin/console assets:install public --relative --symlink + + - name: Easy Coding Standard Check + continue-on-error: true + run: | + bin/console cache:warmup --env=test + vendor/bin/ecs check ${{ github.workspace }}/lib/test-bundle/src --config ${{ github.workspace }}/lib/test-bundle/ecs.php \ No newline at end of file diff --git a/.github/workflows/php-stan.yml b/.github/workflows/php-stan.yml new file mode 100644 index 00000000..b2ba4146 --- /dev/null +++ b/.github/workflows/php-stan.yml @@ -0,0 +1,116 @@ +name: PHP Stan +on: + push: + branches: [ 'master' ] + pull_request: + branches: [ 'master' ] + +jobs: + stan: + runs-on: ubuntu-latest + env: + TEST_BUNDLE_NAME: "SecureStorageBundle" + TEST_BUNDLE_INSTALLER_CLASS: false + TEST_BUNDLE_TEST_DIR: "${{ github.workspace }}/lib/test-bundle/tests" + TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}" + + PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework" + PIMCORE_CODECEPTION_VERSION: "3.0" + + APP_ENV: test + PIMCORE_TEST_DB_DSN: "mysql://root:root@127.0.0.1:3306/dachcom_bundle_test" + PIMCORE_TEST_URL: "http://localhost" + + SYMFONY_DEPRECATIONS_HELPER: "weak" + PIMCORE_PHP_ERROR_REPORTING: 32767 + + WEBDRIVER_HOST: localhost + WEBDRIVER_URL: "http://localhost:8080/" + + services: + mysql: + image: mysql:8.0 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + strategy: + matrix: + php: [ 8.3 ] + symfony: [ ^6.4 ] + pimcore: [ ~11.3.0 ] + include: + - pimcore: ~11.3.0 + template_tag: v2024.2.1 + steps: + - uses: actions/checkout@v2 + with: + path: lib/test-bundle + + - name: Generate Application Structure + run: | + git clone -b ${{ matrix.template_tag }} --single-branch --depth 1 https://github.com/pimcore/skeleton.git + mv skeleton/composer.json . + mv skeleton/bin . + mv skeleton/config . + mv skeleton/public . + mv skeleton/src . + mv skeleton/templates . + mv skeleton/var . + rm -r skeleton + + - name: Setup Pimcore Codeception Framework + env: + MATRIX_PIMCORE_VERSION: ${{ matrix.pimcore }} + MATRIX_PIMCORE_TEMPLATE_TAG: ${{ matrix.template_tag }} + run: | + git clone -b ${{ env.PIMCORE_CODECEPTION_VERSION }} --single-branch --depth 1 https://github.com/dachcom-digital/pimcore-codeception-framework.git + ls -al pimcore-codeception-framework + chmod +x ./pimcore-codeception-framework/src/_etc/scripts/setup.sh + ./pimcore-codeception-framework/src/_etc/scripts/setup.sh + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: intl + coverage: none + + - name: Check PHP Version + run: php -v + + - name: Setup MySql + run: | + sudo systemctl start mysql + mysql -uroot -proot -h127.0.0.1 -e "CREATE DATABASE dachcom_bundle_test CHARSET=utf8mb4;" + + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache Composer Downloads + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Composer install + env: + TEST_PIMCORE_VERSION: ${{ matrix.pimcore }} + TEST_SYMFONY_VERSION: ${{ matrix.symfony }} + run: | + chmod +x ./pimcore-codeception-framework/src/_etc/scripts/composer.sh + ./pimcore-codeception-framework/src/_etc/scripts/composer.sh + + - name: Assets Install + run: | + bin/console assets:install public --relative --symlink + + - name: Php Stan + run: | + bin/console cache:warmup --env=test + vendor/bin/phpstan analyse -c${{ github.workspace }}/lib/test-bundle/phpstan.neon -a ${{ github.workspace }}/lib/test-bundle/tests/_phpstan-bootstrap.php ${{ github.workspace }}/lib/test-bundle/src -l 4 \ No newline at end of file diff --git a/README.md b/README.md index 3a5e660b..643dec9e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ | Release | Supported Pimcore Versions | Supported Symfony Versions | Release Date | Maintained | Branch | |---------|----------------------------|----------------------------|--------------|----------------|--------| -| **1.x** | `^11.3` | `6.2` | -- | Feature Branch | master | +| **1.x** | `^11.3` | `^6.4` | -- | Feature Branch | master | ## Installation diff --git a/ecs.php b/ecs.php index b5e05a8e..b04a5740 100644 --- a/ecs.php +++ b/ecs.php @@ -1,162 +1,139 @@ parameters(); - $parameters->set(Option::SETS, [SetList::CLEAN_CODE, SetList::PSR_12]); + $ecsConfig->sets([SetList::CLEAN_CODE, SetList::PSR_12]); - $services = $containerConfigurator->services(); + $ecsConfig->ruleWithConfiguration(Fixer\Basic\BracesFixer::class, [ + 'allow_single_line_closure' => true, + ]); - $services->set(Fixer\Basic\BracesFixer::class) - ->call('configure', [ - [ - 'allow_single_line_closure' => true, - ] - ]); + $ecsConfig->rule(Fixer\PhpTag\BlankLineAfterOpeningTagFixer::class); - $services->set(Fixer\PhpTag\BlankLineAfterOpeningTagFixer::class); + $ecsConfig->ruleWithConfiguration(Fixer\Operator\ConcatSpaceFixer::class, [ + 'spacing' => 'one', + ] + ); - $services->set(Fixer\Operator\ConcatSpaceFixer::class) - ->call('configure', [ - [ - 'spacing' => 'one', - ] - ]); + $ecsConfig->rule(Fixer\Operator\NewWithBracesFixer::class); - $services->set(Fixer\Operator\NewWithBracesFixer::class); + $ecsConfig->ruleWithConfiguration(Fixer\Phpdoc\PhpdocAlignFixer::class, [ + 'tags' => ['method', 'param', 'property', 'return', 'throws', 'type', 'var'], + ] + ); - $services->set(Fixer\Phpdoc\PhpdocAlignFixer::class) - ->call('configure', [ - [ - 'tags' => ['method', 'param', 'property', 'return', 'throws', 'type', 'var'], - ] - ]); - - $services->set(Fixer\Operator\BinaryOperatorSpacesFixer::class) - ->call('configure', [ - [ - 'operators' => [ - '=' => 'single_space', - '=>' => 'align', - ] - ] - ]); - $services->set(Fixer\Operator\IncrementStyleFixer::class) - ->call('configure', [ - [ - 'style' => 'post', - ] - ]); - - $services->set(Fixer\Operator\UnaryOperatorSpacesFixer::class); - $services->set(Fixer\Whitespace\BlankLineBeforeStatementFixer::class); - $services->set(Fixer\CastNotation\CastSpacesFixer::class); - $services->set(Fixer\LanguageConstruct\DeclareEqualNormalizeFixer::class); - $services->set(Fixer\FunctionNotation\FunctionTypehintSpaceFixer::class); - $services->set(Fixer\Comment\SingleLineCommentStyleFixer::class) - ->call('configure', [ - [ - 'comment_types' => ['hash'], + $ecsConfig->ruleWithConfiguration(Fixer\Operator\BinaryOperatorSpacesFixer::class, [ + 'operators' => [ + '=' => 'single_space', + '=>' => 'align', ] - ]); - - $services->set(Fixer\ControlStructure\IncludeFixer::class); - $services->set(Fixer\CastNotation\LowercaseCastFixer::class); - $services->set(Fixer\ClassNotation\ClassAttributesSeparationFixer::class) - ->call('configure', [ - [ - 'elements' => [ - 'const' => 'none', - 'method' => 'one', - 'property' => 'none', - 'trait_import' => 'none' - ], - ] - ]); - - $services->set(Fixer\Casing\NativeFunctionCasingFixer::class); - $services->set(Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer::class); - $services->set(Fixer\Phpdoc\NoBlankLinesAfterPhpdocFixer::class); - $services->set(Fixer\Comment\NoEmptyCommentFixer::class); - $services->set(Fixer\Phpdoc\NoEmptyPhpdocFixer::class); - $services->set(Fixer\Phpdoc\PhpdocSeparationFixer::class); - $services->set(Fixer\Semicolon\NoEmptyStatementFixer::class); - $services->set(Fixer\Whitespace\ArrayIndentationFixer::class); - $services->set(Fixer\Whitespace\NoExtraBlankLinesFixer::class) - ->call('configure', [ - [ - 'tokens' => ['curly_brace_block', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'throw', 'use'], - ] - ]); - - $services->set(Fixer\NamespaceNotation\NoLeadingNamespaceWhitespaceFixer::class); - $services->set(Fixer\ArrayNotation\NoMultilineWhitespaceAroundDoubleArrowFixer::class); - $services->set(Fixer\CastNotation\NoShortBoolCastFixer::class); - $services->set(Fixer\Semicolon\NoSinglelineWhitespaceBeforeSemicolonsFixer::class); - $services->set(Fixer\Whitespace\NoSpacesAroundOffsetFixer::class); - $services->set(Fixer\ControlStructure\NoTrailingCommaInListCallFixer::class); - $services->set(Fixer\ControlStructure\NoUnneededControlParenthesesFixer::class); - $services->set(Fixer\ArrayNotation\NoWhitespaceBeforeCommaInArrayFixer::class); - $services->set(Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); - $services->set(Fixer\ArrayNotation\NormalizeIndexBraceFixer::class); - $services->set(Fixer\Operator\ObjectOperatorWithoutWhitespaceFixer::class); - $services->set(Fixer\Phpdoc\PhpdocAnnotationWithoutDotFixer::class); - $services->set(Fixer\Phpdoc\PhpdocIndentFixer::class); - $services->set(Fixer\Phpdoc\PhpdocInlineTagFixer::class); - $services->set(Fixer\Phpdoc\PhpdocNoAccessFixer::class); - $services->set(Fixer\Phpdoc\PhpdocNoEmptyReturnFixer::class); - $services->set(Fixer\Phpdoc\PhpdocNoPackageFixer::class); - $services->set(Fixer\Phpdoc\PhpdocNoUselessInheritdocFixer::class); - $services->set(Fixer\Phpdoc\PhpdocReturnSelfReferenceFixer::class); - $services->set(Fixer\Phpdoc\PhpdocScalarFixer::class); - $services->set(Fixer\Phpdoc\PhpdocSingleLineVarSpacingFixer::class); - $services->set(Fixer\Phpdoc\PhpdocSummaryFixer::class); - $services->set(Fixer\Phpdoc\PhpdocToCommentFixer::class); - $services->set(Fixer\Phpdoc\PhpdocTrimFixer::class); - $services->set(Fixer\Phpdoc\PhpdocTypesFixer::class); - $services->set(Fixer\Phpdoc\PhpdocVarWithoutNameFixer::class); - $services->set(Fixer\FunctionNotation\ReturnTypeDeclarationFixer::class); - $services->set(Fixer\ClassNotation\SelfAccessorFixer::class); - $services->set(Fixer\CastNotation\ShortScalarCastFixer::class); - $services->set(Fixer\StringNotation\SingleQuoteFixer::class); - $services->set(Fixer\Semicolon\SpaceAfterSemicolonFixer::class); - $services->set(Fixer\Operator\StandardizeNotEqualsFixer::class); - $services->set(Fixer\Operator\TernaryOperatorSpacesFixer::class); - $services->set(Fixer\ArrayNotation\TrimArraySpacesFixer::class); - $services->set(Fixer\ArrayNotation\WhitespaceAfterCommaInArrayFixer::class); - - $services->set(Fixer\ClassNotation\ClassDefinitionFixer::class) - ->call('configure', [ - [ - 'single_line' => true, - ] - ]); - - $services->set(Fixer\Casing\MagicConstantCasingFixer::class); - $services->set(Fixer\FunctionNotation\MethodArgumentSpaceFixer::class); - $services->set(Fixer\Alias\NoMixedEchoPrintFixer::class) - ->call('configure', [ - [ - 'use' => 'echo', - ] - ]); - - $services->set(Fixer\Import\NoLeadingImportSlashFixer::class); - $services->set(Fixer\PhpUnit\PhpUnitFqcnAnnotationFixer::class); - $services->set(Fixer\Phpdoc\PhpdocNoAliasTagFixer::class); - $services->set(Fixer\NamespaceNotation\SingleBlankLineBeforeNamespaceFixer::class); - $services->set(Fixer\ClassNotation\SingleClassElementPerStatementFixer::class); + ] + ); + + $ecsConfig->ruleWithConfiguration(Fixer\Operator\IncrementStyleFixer::class, [ + 'style' => 'post', + ] + ); + + $ecsConfig->rule(Fixer\Operator\UnaryOperatorSpacesFixer::class); + $ecsConfig->rule(Fixer\Whitespace\BlankLineBeforeStatementFixer::class); + $ecsConfig->rule(Fixer\CastNotation\CastSpacesFixer::class); + $ecsConfig->rule(Fixer\LanguageConstruct\DeclareEqualNormalizeFixer::class); + $ecsConfig->rule(Fixer\FunctionNotation\FunctionTypehintSpaceFixer::class); + $ecsConfig->ruleWithConfiguration(Fixer\Comment\SingleLineCommentStyleFixer::class, [ + 'comment_types' => ['hash'], + ] + ); + + $ecsConfig->rule(Fixer\ControlStructure\IncludeFixer::class); + $ecsConfig->rule(Fixer\CastNotation\LowercaseCastFixer::class); + $ecsConfig->ruleWithConfiguration(Fixer\ClassNotation\ClassAttributesSeparationFixer::class, [ + 'elements' => [ + 'const' => 'none', + 'method' => 'one', + 'property' => 'none', + 'trait_import' => 'none' + ], + ] + ); + + $ecsConfig->rule(Fixer\Casing\NativeFunctionCasingFixer::class); + $ecsConfig->rule(Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\NoBlankLinesAfterPhpdocFixer::class); + $ecsConfig->rule(Fixer\Comment\NoEmptyCommentFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\NoEmptyPhpdocFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocSeparationFixer::class); + $ecsConfig->rule(Fixer\Semicolon\NoEmptyStatementFixer::class); + $ecsConfig->rule(Fixer\Whitespace\ArrayIndentationFixer::class); + $ecsConfig->ruleWithConfiguration(Fixer\Whitespace\NoExtraBlankLinesFixer::class, [ + 'tokens' => ['curly_brace_block', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'throw', 'use'], + ] + ); + + $ecsConfig->rule(Fixer\NamespaceNotation\NoLeadingNamespaceWhitespaceFixer::class); + $ecsConfig->rule(Fixer\ArrayNotation\NoMultilineWhitespaceAroundDoubleArrowFixer::class); + $ecsConfig->rule(Fixer\CastNotation\NoShortBoolCastFixer::class); + $ecsConfig->rule(Fixer\Semicolon\NoSinglelineWhitespaceBeforeSemicolonsFixer::class); + $ecsConfig->rule(Fixer\Whitespace\NoSpacesAroundOffsetFixer::class); + $ecsConfig->rule(Fixer\ControlStructure\NoTrailingCommaInListCallFixer::class); + $ecsConfig->rule(Fixer\ControlStructure\NoUnneededControlParenthesesFixer::class); + $ecsConfig->rule(Fixer\ArrayNotation\NoWhitespaceBeforeCommaInArrayFixer::class); + $ecsConfig->rule(Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); + $ecsConfig->rule(Fixer\ArrayNotation\NormalizeIndexBraceFixer::class); + $ecsConfig->rule(Fixer\Operator\ObjectOperatorWithoutWhitespaceFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocAnnotationWithoutDotFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocIndentFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocInlineTagNormalizerFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocNoAccessFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocNoEmptyReturnFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocNoPackageFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocNoUselessInheritdocFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocReturnSelfReferenceFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocScalarFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocSingleLineVarSpacingFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocSummaryFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocToCommentFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocTrimFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocTypesFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocVarWithoutNameFixer::class); + $ecsConfig->rule(Fixer\FunctionNotation\ReturnTypeDeclarationFixer::class); + $ecsConfig->rule(Fixer\ClassNotation\SelfAccessorFixer::class); + $ecsConfig->rule(Fixer\CastNotation\ShortScalarCastFixer::class); + $ecsConfig->rule(Fixer\StringNotation\SingleQuoteFixer::class); + $ecsConfig->rule(Fixer\Semicolon\SpaceAfterSemicolonFixer::class); + $ecsConfig->rule(Fixer\Operator\StandardizeNotEqualsFixer::class); + $ecsConfig->rule(Fixer\Operator\TernaryOperatorSpacesFixer::class); + $ecsConfig->rule(Fixer\ArrayNotation\TrimArraySpacesFixer::class); + $ecsConfig->rule(Fixer\ArrayNotation\WhitespaceAfterCommaInArrayFixer::class); + $ecsConfig->rule(Fixer\Import\NoUnusedImportsFixer::class); + + $ecsConfig->ruleWithConfiguration(Fixer\ClassNotation\ClassDefinitionFixer::class, [ + 'single_line' => true, + ] + ); + + $ecsConfig->rule(Fixer\Casing\MagicConstantCasingFixer::class); + $ecsConfig->rule(Fixer\FunctionNotation\MethodArgumentSpaceFixer::class); + $ecsConfig->ruleWithConfiguration(Fixer\Alias\NoMixedEchoPrintFixer::class, [ + 'use' => 'echo', + ] + ); + + $ecsConfig->rule(Fixer\Import\NoLeadingImportSlashFixer::class); + $ecsConfig->rule(Fixer\PhpUnit\PhpUnitFqcnAnnotationFixer::class); + $ecsConfig->rule(Fixer\Phpdoc\PhpdocNoAliasTagFixer::class); + $ecsConfig->rule(Fixer\NamespaceNotation\SingleBlankLineBeforeNamespaceFixer::class); + $ecsConfig->rule(Fixer\ClassNotation\SingleClassElementPerStatementFixer::class); # new since PHP-CS-Fixer 2.6 - $services->set(Fixer\ClassNotation\NoUnneededFinalMethodFixer::class); - $services->set(Fixer\Semicolon\SemicolonAfterInstructionFixer::class); + $ecsConfig->rule(Fixer\ClassNotation\NoUnneededFinalMethodFixer::class); + $ecsConfig->rule(Fixer\Semicolon\SemicolonAfterInstructionFixer::class); # new since 2.11 - $services->set(Fixer\Operator\StandardizeIncrementFixer::class); -}; \ No newline at end of file + $ecsConfig->rule(Fixer\Operator\StandardizeIncrementFixer::class); +}; diff --git a/phpstan.neon b/phpstan.neon index 58b21458..334b250e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -7,8 +7,3 @@ parameters: symfony: container_xml_path: %currentWorkingDirectory%/var/cache/test/TestKernelTestDebugContainer.xml constant_hassers: false - excludePaths: - # as long we don't install the dependencies :( - - src/MetaData/Extractor/ThirdParty/News/EntryMetaExtractor.php - - src/MetaData/Extractor/ThirdParty/CoreShop/OGExtractor.php - - src/MetaData/Extractor/ThirdParty/CoreShop/TitleDescriptionExtractor.php diff --git a/tests/Functional.suite.dist.yml b/tests/Functional.suite.dist.yml new file mode 100644 index 00000000..3b28e68b --- /dev/null +++ b/tests/Functional.suite.dist.yml @@ -0,0 +1,12 @@ +actor: FunctionalTester +modules: + enabled: + - \Dachcom\Codeception\Support\Helper\PimcoreCore: + connect_db: true + rebootable_client: true + - \Dachcom\Codeception\Support\Helper\PimcoreBundleCore: + run_installer: true + - \Dachcom\Codeception\Support\Helper\Browser\PhpBrowser: + depends: \Dachcom\Codeception\Support\Helper\PimcoreCore + - \Dachcom\Codeception\Support\Helper\PimcoreBackend + - \Dachcom\Codeception\Support\Helper\PimcoreUser diff --git a/tests/Functional/_bootstrap.php b/tests/Functional/_bootstrap.php new file mode 100644 index 00000000..94bf66cf --- /dev/null +++ b/tests/Functional/_bootstrap.php @@ -0,0 +1,2 @@ +renderTemplate('default/default.html.twig'); + } +} diff --git a/tests/_etc/config/app/system_settings.yaml b/tests/_etc/config/app/system_settings.yaml new file mode 100755 index 00000000..40ae8b4f --- /dev/null +++ b/tests/_etc/config/app/system_settings.yaml @@ -0,0 +1,47 @@ +pimcore: + general: + timezone: Europe/Berlin + domain: 'localhost' + redirect_to_maindomain: false + disable_usage_statistics: true + debug_admin_translations: false + default_language: en + valid_languages: + - en + - de + fallback_languages: + en: '' + de: '' + documents: + allow_trailing_slash: 'no' + generate_preview: false + versions: + days: null + steps: 10 + error_pages: + default: '/error' + localized: + en: '' + de: '' + objects: + versions: + days: null + steps: 10 + assets: + versions: + days: null + steps: 10 + email: + debug: + email_addresses: development@dachcom.ch + +pimcore_admin: + assets: + hide_edit_image: true + disable_tree_preview: true + branding: + login_screen_invert_colors: false + color_login_screen: '' + color_admin_interface: '' + color_admin_interface_background: '' + login_screen_custom_image: '' diff --git a/tests/_etc/config/app/templates/default.html.twig b/tests/_etc/config/app/templates/default.html.twig new file mode 100644 index 00000000..2c65722a --- /dev/null +++ b/tests/_etc/config/app/templates/default.html.twig @@ -0,0 +1,21 @@ + + + + + {{ pimcore_head_title() }} + {{ pimcore_head_meta() }} + {{ pimcore_head_link() }} + + +
+
+ {% if document is defined %} + {{ document.id }} + {% endif %} +
+ {% block content %} + {{ pimcore_areablock('bundleTestArea') }} + {% endblock %} +
+ + diff --git a/tests/_etc/config/bundle/config_default.yaml b/tests/_etc/config/bundle/config_default.yaml new file mode 100755 index 00000000..e69de29b diff --git a/tests/_phpstan-bootstrap.php b/tests/_phpstan-bootstrap.php new file mode 100644 index 00000000..0c3c5270 --- /dev/null +++ b/tests/_phpstan-bootstrap.php @@ -0,0 +1,6 @@ +