Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: compatibility with magento coding standard v33 #10

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/install_coding_standard.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ composer global require --no-interaction ${CODING_STANDARD}:${INPUT_CODING_STAND

# Fixme: find a better way to handle adding standards
if [ "${CODING_STANDARD}" = "magento/magento-coding-standard" ] ; then
composer global -- exec phpcs --config-set installed_paths \
../../magento/magento-coding-standard/,../../phpcompatibility/php-compatibility
INSTALL_PATHS="../../magento/magento-coding-standard/"
if composer global show magento/php-compatibility-fork > /dev/null 2>&1; then
INSTALL_PATHS="${INSTALL_PATHS},../../magento/php-compatibility-fork"
fi

if composer global show phpcompatibility/php-compatibility > /dev/null 2>&1; then
INSTALL_PATHS="${INSTALL_PATHS},../../phpcompatibility/php-compatibility"
fi

composer global -- exec phpcs --config-set installed_paths "$INSTALL_PATHS"
fi
14 changes: 14 additions & 0 deletions tests/install_magento_coding_standard.bats
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ teardown() {
run install_coding_standard.bash
run composer global info
[[ "$output" =~ "magento/magento-coding-standard"\ *30 ]]
run composer global -- exec "phpcs --config-show"
[[ "$output" =~ "phpcompatibility/php-compatibility" ]]
}

@test "Coding standard is installed with version 33" {
if ! command -v composer > /dev/null ; then
skip "Composer is not installed."
fi
export INPUT_CODING_STANDARD_VERSION=33
run install_coding_standard.bash
run composer global info
[[ "$output" =~ "magento/magento-coding-standard"\ *33 ]]
run composer global -- exec "phpcs --config-show"
[[ "$output" =~ "magento/php-compatibility-fork" ]]
}

@test "Coding standard package is installed" {
Expand Down
Loading