diff --git a/.travis.yml b/.travis.yml index 182dde46e..b8b726c72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ --- language: php -php: 7.1 +php: "7.1" addons: chrome: stable @@ -29,16 +29,17 @@ matrix: fast_finish: true include: - { name: "Static code analysis", env: ORCA_JOB=STATIC_CODE_ANALYSIS } - - { name: "Deprecated code scan of SUT only", env: ORCA_JOB=DEPRECATED_CODE_SCAN_SUT } - - { name: "Deprecated code scan of SUT plus contrib", env: ORCA_JOB=DEPRECATED_CODE_SCAN_CONTRIB } + - { name: "Deprecated code scan of SUT", env: ORCA_JOB=DEPRECATED_CODE_SCAN_SUT } + - { name: "Deprecated code scan of contrib", env: ORCA_JOB=DEPRECATED_CODE_SCAN_CONTRIB ORCA_PACKAGES_CONFIG=config/packages.yml ORCA_PACKAGES_CONFIG_ALTER= } - { name: "Isolated test w/ recommended package versions", env: ORCA_JOB=ISOLATED_RECOMMENDED } - { name: "Integrated test w/ recommended package versions", env: ORCA_JOB=INTEGRATED_RECOMMENDED } - { name: "Integrated test w/ recommended package versions & previous minor release of Drupal core", env: ORCA_JOB=CORE_PREVIOUS } - { name: "Isolated test w/ dev package versions", env: ORCA_JOB=ISOLATED_DEV } - { name: "Integrated test w/ dev package versions", env: ORCA_JOB=INTEGRATED_DEV } - { name: "Integrated test w/ dev package versions & next minor dev version of Drupal core", env: ORCA_JOB=CORE_NEXT } + - { name: "Custom job", env: ORCA_JOB=CUSTOM ORCA_CUSTOM_FIXTURE_INIT_ARGS="--help" ORCA_CUSTOM_TESTS_RUN_ARGS="--help" } allow_failures: - - env: ORCA_JOB=DEPRECATED_CODE_SCAN_CONTRIB + - env: ORCA_JOB=DEPRECATED_CODE_SCAN_CONTRIB ORCA_PACKAGES_CONFIG=config/packages.yml ORCA_PACKAGES_CONFIG_ALTER= before_install: ../orca/bin/travis/before_install.sh diff --git a/bin/travis/_includes.sh b/bin/travis/_includes.sh index 9bb820f13..0d679e81c 100755 --- a/bin/travis/_includes.sh +++ b/bin/travis/_includes.sh @@ -4,7 +4,7 @@ # _includes.sh - Include reusable code. # # SYNOPSIS -# cd "$(dirname "$0")"; source _includes.sh +# cd "$(dirname "$0")" || exit; source _includes.sh # # DESCRIPTION # Includes common features used by the Travis CI scripts. @@ -15,25 +15,26 @@ function assert { if [[ ! "$1" ]]; then RED="\033[1;31m" NO_COLOR="\033[0m" - echo -e "\n${RED}Error: $2${NO_COLOR}\n" + printf "\n%bError: %b%b\n" "$RED" "$2" "$NO_COLOR" exit 1 fi } # Asserts that necessary environment variables are set. function assert_env_vars { - assert "$ORCA_SUT_NAME" "Missing required ORCA_SUT_NAME environment variable.\nHint: ORCA_SUT_NAME=drupal/example" - assert "$ORCA_SUT_BRANCH" "Missing required ORCA_SUT_BRANCH environment variable.\nHint: ORCA_SUT_BRANCH=8.x-1.x" + if [[ "$ORCA_JOB" != "DEPRECATED_CODE_SCAN_CONTRIB" ]]; then + assert "$ORCA_SUT_NAME" "Missing required ORCA_SUT_NAME environment variable.\nHint: ORCA_SUT_NAME=drupal/example" + if [[ "$TRAVIS" ]]; then assert "$ORCA_SUT_BRANCH" "Missing required ORCA_SUT_BRANCH environment variable.\nHint: ORCA_SUT_BRANCH=8.x-1.x"; fi + fi + if [[ ! "$TRAVIS" && "$ORCA_JOB" = "STATIC_CODE_ANALYSIS" ]]; then assert "$ORCA_SUT_DIR" "Missing required ORCA_SUT_DIR environment variable.\nHint: ORCA_SUT_DIR=~/Projects/example"; fi } -# Prevent CI scripts from being run locally. -assert "$TRAVIS" "This script is meant to run on Travis CI only." - # Set environment variables. -export ORCA_ROOT="$(cd "$(dirname "$BASH_SOURCE")/../.." && pwd)" -export ORCA_FIXTURE_DIR=${ORCA_FIXTURE_DIR:="${ORCA_ROOT}/../orca-build"} -export ORCA_FIXTURE_DOCROOT=${ORCA_FIXTURE_DIR}/docroot +ORCA_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +export ORCA_ROOT +export ORCA_FIXTURE_DIR=${ORCA_FIXTURE_DIR:="$ORCA_ROOT/../orca-build"} export ORCA_SUT_DIR=${ORCA_SUT_DIR:=${TRAVIS_BUILD_DIR}} +export ORCA_FIXTURE_PROFILE=${ORCA_FIXTURE_PROFILE:="minimal"} # Add binary directories to PATH. export PATH="$HOME/.composer/vendor/bin:$PATH" @@ -43,7 +44,7 @@ export PATH="$ORCA_FIXTURE_DIR/vendor/bin:$PATH" export PATH="$TRAVIS_BUILD_DIR/vendor/bin:$PATH" # Add convenient aliases. -alias drush="drush -r ${ORCA_FIXTURE_DOCROOT}" +alias drush='drush -r "$ORCA_FIXTURE_DIR"' # Exit as soon as one command returns a non-zero exit code and make the shell # print all lines in the script before executing them. diff --git a/bin/travis/after_failure.sh b/bin/travis/after_failure.sh index b85b91ccf..85e6e0de7 100755 --- a/bin/travis/after_failure.sh +++ b/bin/travis/after_failure.sh @@ -9,7 +9,7 @@ # DESCRIPTION # Displays Drupal error log. -cd "$(dirname "$0")"; source _includes.sh +cd "$(dirname "$0")" || exit; source _includes.sh if [[ -f "$ORCA_FIXTURE_DIR/vendor/bin/drush" && "$(drush core-status --field=bootstrap)" ]]; then drush watchdog:show --count=100 --severity=Error --extended diff --git a/bin/travis/before_install.sh b/bin/travis/before_install.sh index 9d85e74fe..3ad92facb 100755 --- a/bin/travis/before_install.sh +++ b/bin/travis/before_install.sh @@ -9,7 +9,33 @@ # DESCRIPTION # Configures the Travis CI environment, installs ORCA, and prepares the SUT. -cd "$(dirname "$0")"; source _includes.sh +cd "$(dirname "$0")" || exit; source _includes.sh + +# Display configuration values. +set +v +CONFIG_VARS=( + ORCA_CUSTOM_FIXTURE_INIT_ARGS + ORCA_CUSTOM_TESTS_RUN_ARGS + ORCA_FIXTURE_DIR + ORCA_FIXTURE_PROFILE + ORCA_JOB + ORCA_PACKAGES_CONFIG + ORCA_PACKAGES_CONFIG_ALTER + ORCA_ROOT + ORCA_SUT_BRANCH + ORCA_SUT_DIR + ORCA_SUT_NAME +) +for CONFIG_VAR in "${CONFIG_VARS[@]}"; do + eval "echo ${CONFIG_VAR} = $""$CONFIG_VAR" +done +set -v + +# Make Composer Patches throw an error when it can't apply a patch. +export COMPOSER_EXIT_ON_PATCH_FAILURE=1 + +# The remaining before_install commands should only be run on Travis CI. +[[ "$TRAVIS" ]] || exit # Display the Google Chrome version. google-chrome-stable --version @@ -17,14 +43,14 @@ google-chrome-stable --version # Disable Xdebug. phpenv config-rm xdebug.ini -# Remove PHP memory limit. -echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - -# Prevent email errors. -echo 'sendmail_path = /bin/true' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - -# Prevent PHPStan warnings about APCu constants. -echo 'extension = apcu.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini +{ + # Remove PHP memory limit. + echo 'memory_limit = -1' + # Prevent email errors. + echo 'sendmail_path = /bin/true' + # Prevent PHPStan warnings about APCu constants. + echo 'extension = apcu.so' +} >> "$HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini" # Install the PECL YAML parser for strict YAML parsing. yes | pecl install yaml @@ -34,15 +60,14 @@ composer global require \ hirak/prestissimo \ zaporylie/composer-drupal-optimizations -# Make Composer Patches throw an error when it can't apply a patch. -export COMPOSER_EXIT_ON_PATCH_FAILURE=1 - # Install ORCA. -composer -d${ORCA_ROOT} install +composer -d"$ORCA_ROOT" install + +orca --version # Ensure the checked out branch is named after the nearest Git version branch. -git -C "${ORCA_SUT_DIR}" rev-parse --abbrev-ref HEAD -if [[ $(git -C "${ORCA_SUT_DIR}" rev-parse --abbrev-ref HEAD) != "$ORCA_SUT_BRANCH" ]]; then - git -C "${ORCA_SUT_DIR}" branch -f "$ORCA_SUT_BRANCH" - git -C "${ORCA_SUT_DIR}" checkout "$ORCA_SUT_BRANCH" +git -C "$ORCA_SUT_DIR" rev-parse --abbrev-ref HEAD +if [[ $(git -C "$ORCA_SUT_DIR" rev-parse --abbrev-ref HEAD) != "$ORCA_SUT_BRANCH" ]]; then + git -C "$ORCA_SUT_DIR" branch -f "$ORCA_SUT_BRANCH" + git -C "$ORCA_SUT_DIR" checkout "$ORCA_SUT_BRANCH" fi diff --git a/bin/travis/before_script.sh b/bin/travis/before_script.sh index f047f53fa..533590960 100755 --- a/bin/travis/before_script.sh +++ b/bin/travis/before_script.sh @@ -10,16 +10,19 @@ # Displays information about installed Composer packages and Drupal # projects. -cd "$(dirname "$0")"; source _includes.sh +cd "$(dirname "$0")" || exit; source _includes.sh # Exit early in the absence of a fixture. [[ -d "$ORCA_FIXTURE_DIR" ]] || exit 0 # Display installed Composer packages. -composer -d${ORCA_FIXTURE_DIR} show +composer -d"$ORCA_FIXTURE_DIR" show + +# Display outdated Composer packages information. +composer -d"$ORCA_FIXTURE_DIR" outdated # Display the list of available Drupal extensions (modules and themes). -drush --no-ansi pm:list || true +drush --no-ansi pm:list --fields=package,display_name,type,status,version || true # Display basic Drupal site details. drush core-status diff --git a/bin/travis/install.sh b/bin/travis/install.sh index 277c8c3c6..87fde4511 100755 --- a/bin/travis/install.sh +++ b/bin/travis/install.sh @@ -9,22 +9,18 @@ # DESCRIPTION # Creates the test fixture. -cd "$(dirname "$0")"; source _includes.sh +cd "$(dirname "$0")" || exit; source _includes.sh assert_env_vars -[[ "$ORCA_JOB" != "DEPRECATED_CODE_SCAN_SUT" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME} --sut-only --no-site-install - -[[ "$ORCA_JOB" != "DEPRECATED_CODE_SCAN_CONTRIB" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME} --sut-only --no-site-install - -[[ "$ORCA_JOB" != "ISOLATED_RECOMMENDED" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME} --sut-only - -[[ "$ORCA_JOB" != "INTEGRATED_RECOMMENDED" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME} - -[[ "$ORCA_JOB" != "CORE_PREVIOUS" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME} --core=PREVIOUS_RELEASE - -[[ "$ORCA_JOB" != "ISOLATED_DEV" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME} --sut-only --dev - -[[ "$ORCA_JOB" != "INTEGRATED_DEV" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME} --dev - -[[ "$ORCA_JOB" != "CORE_NEXT" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME} --core=NEXT_DEV --dev +case "$ORCA_JOB" in + "DEPRECATED_CODE_SCAN_SUT") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --sut-only --no-site-install" ;; + "DEPRECATED_CODE_SCAN_CONTRIB") eval "orca fixture:init -f --no-site-install" ;; + "ISOLATED_RECOMMENDED") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --sut-only --core=CURRENT_RECOMMENDED --profile=$ORCA_FIXTURE_PROFILE" ;; + "INTEGRATED_RECOMMENDED") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --core=CURRENT_RECOMMENDED --profile=$ORCA_FIXTURE_PROFILE" ;; + "CORE_PREVIOUS") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --core=PREVIOUS_RELEASE --profile=$ORCA_FIXTURE_PROFILE" ;; + "ISOLATED_DEV") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --sut-only --core=CURRENT_DEV --dev --profile=$ORCA_FIXTURE_PROFILE" ;; + "INTEGRATED_DEV") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --core=CURRENT_DEV --dev --profile=$ORCA_FIXTURE_PROFILE" ;; + "CORE_NEXT") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --core=NEXT_DEV --dev --profile=$ORCA_FIXTURE_PROFILE" ;; + "CUSTOM") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --profile=$ORCA_FIXTURE_PROFILE ${ORCA_CUSTOM_FIXTURE_INIT_ARGS:=}" ;; +esac diff --git a/bin/travis/script.sh b/bin/travis/script.sh index 085225c62..a4f7c807a 100755 --- a/bin/travis/script.sh +++ b/bin/travis/script.sh @@ -9,26 +9,23 @@ # DESCRIPTION # Runs static code analysis and automated tests. -cd "$(dirname "$0")"; source _includes.sh +cd "$(dirname "$0")" || exit; source _includes.sh assert_env_vars [[ ! -d "$ORCA_FIXTURE_DIR" ]] || orca fixture:status -[[ "$ORCA_JOB" != "STATIC_CODE_ANALYSIS" ]] || orca static-analysis:run ${ORCA_SUT_DIR} - -[[ "$ORCA_JOB" != "DEPRECATED_CODE_SCAN_SUT" ]] || orca deprecated-code-scan:run --sut=${ORCA_SUT_NAME} - -[[ "$ORCA_JOB" != "DEPRECATED_CODE_SCAN_CONTRIB" ]] || orca deprecated-code-scan:run --contrib - -[[ "$ORCA_JOB" != "ISOLATED_RECOMMENDED" ]] || orca tests:run --sut=${ORCA_SUT_NAME} --sut-only - -[[ "$ORCA_JOB" != "INTEGRATED_RECOMMENDED" ]] || orca tests:run --sut=${ORCA_SUT_NAME} - -[[ "$ORCA_JOB" != "CORE_PREVIOUS" ]] || orca tests:run --sut=${ORCA_SUT_NAME} - -[[ "$ORCA_JOB" != "ISOLATED_DEV" ]] || orca tests:run --sut=${ORCA_SUT_NAME} --sut-only - -[[ "$ORCA_JOB" != "INTEGRATED_DEV" ]] || orca tests:run --sut=${ORCA_SUT_NAME} - -[[ "$ORCA_JOB" != "CORE_NEXT" ]] || orca tests:run --sut=${ORCA_SUT_NAME} +[[ "$ORCA_FIXTURE_PROFILE" = "minimal" ]] || SUT_ONLY="--sut-only" + +case "$ORCA_JOB" in + "STATIC_CODE_ANALYSIS") eval "orca static-analysis:run $ORCA_SUT_DIR" ;; + "DEPRECATED_CODE_SCAN_SUT") eval "orca deprecated-code-scan:run --sut=$ORCA_SUT_NAME" ;; + "DEPRECATED_CODE_SCAN_CONTRIB") eval "orca deprecated-code-scan:run --contrib" ;; + "ISOLATED_RECOMMENDED") eval "orca tests:run --sut=$ORCA_SUT_NAME --sut-only" ;; + "INTEGRATED_RECOMMENDED") eval "orca tests:run --sut=$ORCA_SUT_NAME $SUT_ONLY" ;; + "CORE_PREVIOUS") eval "orca tests:run --sut=$ORCA_SUT_NAME $SUT_ONLY" ;; + "ISOLATED_DEV") eval "orca tests:run --sut=$ORCA_SUT_NAME --sut-only" ;; + "INTEGRATED_DEV") eval "orca tests:run --sut=$ORCA_SUT_NAME $SUT_ONLY" ;; + "CORE_NEXT") eval "orca tests:run --sut=$ORCA_SUT_NAME $SUT_ONLY" ;; + "CUSTOM") eval "orca tests:run --sut=$ORCA_SUT_NAME ${ORCA_CUSTOM_TESTS_RUN_ARGS:=}" ;; +esac diff --git a/composer.json b/composer.json index 3a3a1c05d..eca0213d0 100644 --- a/composer.json +++ b/composer.json @@ -58,8 +58,7 @@ "pre-commit": [ "set -e", "vendor/bin/parallel-lint --exclude vendor --no-progress .", - "vendor/bin/phpcs --cache=var/.phpcs-cache", - "vendor/bin/phpmd . text phpmd.xml.dist --ignore-violations-on-exit" + "vendor/bin/phpcs --cache=var/.phpcs-cache" ], "post-install-cmd": "vendor/bin/cghooks add --ignore-lock", "post-update-cmd": "vendor/bin/cghooks update" diff --git a/composer.lock b/composer.lock index a9d9449df..0373db112 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "67483347a46f18e9f19ac0803d35199b", + "content-hash": "7fe4dc186c17914845d64fb98b721797", "packages": [ { "name": "behat/behat", @@ -1606,16 +1606,16 @@ }, { "name": "mglaman/phpstan-drupal", - "version": "0.11.4", + "version": "0.11.7", "source": { "type": "git", "url": "https://github.com/mglaman/phpstan-drupal.git", - "reference": "bf4a26fe856a61fe2cbfc191aada702ef0cecac3" + "reference": "5188efcdb19d5e468562c65dbb74bd818f7813d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/bf4a26fe856a61fe2cbfc191aada702ef0cecac3", - "reference": "bf4a26fe856a61fe2cbfc191aada702ef0cecac3", + "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/5188efcdb19d5e468562c65dbb74bd818f7813d4", + "reference": "5188efcdb19d5e468562c65dbb74bd818f7813d4", "shasum": "" }, "require": { @@ -1630,6 +1630,7 @@ "require-dev": { "composer/installers": "^1.6", "drupal/core": "^8.6", + "drush/drush": "^9.6", "phpstan/phpstan-deprecation-rules": "^0.11.0", "phpstan/phpstan-strict-rules": "^0.11", "phpunit/phpunit": "^7.5", @@ -1677,7 +1678,7 @@ } ], "description": "Drupal extension and rules for PHPStan", - "time": "2019-04-08T14:26:27+00:00" + "time": "2019-05-07T21:50:12+00:00" }, { "name": "mglaman/phpstan-drupal-deprecations", @@ -2632,16 +2633,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.0", + "version": "4.3.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", + "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", "shasum": "" }, "require": { @@ -2679,7 +2680,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-30T07:14:17+00:00" + "time": "2019-04-30T17:48:53+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -2906,16 +2907,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.11.5", + "version": "0.11.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "24ce5a566a798b81343138ed5d41d6877554cf9a" + "reference": "7af8b9d02b3ab36444dbf4e1b9ca1c1bd5044d81" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/24ce5a566a798b81343138ed5d41d6877554cf9a", - "reference": "24ce5a566a798b81343138ed5d41d6877554cf9a", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7af8b9d02b3ab36444dbf4e1b9ca1c1bd5044d81", + "reference": "7af8b9d02b3ab36444dbf4e1b9ca1c1bd5044d81", "shasum": "" }, "require": { @@ -2975,7 +2976,7 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2019-03-25T16:40:09+00:00" + "time": "2019-05-08T16:33:56+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -4307,7 +4308,7 @@ }, { "name": "symfony/browser-kit", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", @@ -4364,7 +4365,7 @@ }, { "name": "symfony/class-loader", - "version": "v3.4.26", + "version": "v3.4.27", "source": { "type": "git", "url": "https://github.com/symfony/class-loader.git", @@ -4420,7 +4421,7 @@ }, { "name": "symfony/config", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/config.git", @@ -4483,7 +4484,7 @@ }, { "name": "symfony/console", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", @@ -4555,16 +4556,16 @@ }, { "name": "symfony/contracts", - "version": "v1.0.2", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/symfony/contracts.git", - "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf" + "reference": "d3636025e8253c6144358ec0a62773cae588395b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf", - "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf", + "url": "https://api.github.com/repos/symfony/contracts/zipball/d3636025e8253c6144358ec0a62773cae588395b", + "reference": "d3636025e8253c6144358ec0a62773cae588395b", "shasum": "" }, "require": { @@ -4572,19 +4573,22 @@ }, "require-dev": { "psr/cache": "^1.0", - "psr/container": "^1.0" + "psr/container": "^1.0", + "symfony/polyfill-intl-idn": "^1.10" }, "suggest": { "psr/cache": "When using the Cache contracts", "psr/container": "When using the Service contracts", "symfony/cache-contracts-implementation": "", + "symfony/event-dispatcher-implementation": "", + "symfony/http-client-contracts-implementation": "", "symfony/service-contracts-implementation": "", "symfony/translation-contracts-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.1-dev" } }, "autoload": { @@ -4619,11 +4623,11 @@ "interoperability", "standards" ], - "time": "2018-12-05T08:06:11+00:00" + "time": "2019-04-27T14:29:50+00:00" }, { "name": "symfony/css-selector", - "version": "v3.4.26", + "version": "v3.4.27", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -4676,7 +4680,7 @@ }, { "name": "symfony/debug", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", @@ -4732,16 +4736,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "2748643dd378626c4d348a31ad12394e2d6f7ea8" + "reference": "d161c0c8bc77ad6fdb8f5083b9e34c3015d43eb1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/2748643dd378626c4d348a31ad12394e2d6f7ea8", - "reference": "2748643dd378626c4d348a31ad12394e2d6f7ea8", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/d161c0c8bc77ad6fdb8f5083b9e34c3015d43eb1", + "reference": "d161c0c8bc77ad6fdb8f5083b9e34c3015d43eb1", "shasum": "" }, "require": { @@ -4801,11 +4805,11 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2019-04-16T11:19:53+00:00" + "time": "2019-04-27T11:48:17+00:00" }, { "name": "symfony/dom-crawler", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", @@ -4862,7 +4866,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -4926,7 +4930,7 @@ }, { "name": "symfony/filesystem", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -4976,7 +4980,7 @@ }, { "name": "symfony/finder", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -5025,16 +5029,16 @@ }, { "name": "symfony/http-foundation", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "6ebbe61f48069033225c9d3fa7eb5ed116d766d6" + "reference": "1ea878bd3af18f934dedb8c0de60656a9a31a718" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/6ebbe61f48069033225c9d3fa7eb5ed116d766d6", - "reference": "6ebbe61f48069033225c9d3fa7eb5ed116d766d6", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/1ea878bd3af18f934dedb8c0de60656a9a31a718", + "reference": "1ea878bd3af18f934dedb8c0de60656a9a31a718", "shasum": "" }, "require": { @@ -5075,20 +5079,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2019-04-17T14:56:00+00:00" + "time": "2019-05-01T08:36:31+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "3db83303dbc1da9777e5ff63423b8b7fde423a1b" + "reference": "a7713bc522f1a1cdf0b39f809fa4542523fc3114" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/3db83303dbc1da9777e5ff63423b8b7fde423a1b", - "reference": "3db83303dbc1da9777e5ff63423b8b7fde423a1b", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/a7713bc522f1a1cdf0b39f809fa4542523fc3114", + "reference": "a7713bc522f1a1cdf0b39f809fa4542523fc3114", "shasum": "" }, "require": { @@ -5164,11 +5168,11 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2019-04-17T16:17:13+00:00" + "time": "2019-05-01T13:31:08+00:00" }, { "name": "symfony/options-resolver", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", @@ -5222,16 +5226,16 @@ }, { "name": "symfony/phpunit-bridge", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "12593ad0bc54658d9bc74fa240a545b3873b4626" + "reference": "31f2e3c10bc9bd955ca1ae3e4da2bb489205714a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/12593ad0bc54658d9bc74fa240a545b3873b4626", - "reference": "12593ad0bc54658d9bc74fa240a545b3873b4626", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/31f2e3c10bc9bd955ca1ae3e4da2bb489205714a", + "reference": "31f2e3c10bc9bd955ca1ae3e4da2bb489205714a", "shasum": "" }, "require": { @@ -5283,7 +5287,7 @@ ], "description": "Symfony PHPUnit Bridge", "homepage": "https://symfony.com", - "time": "2019-04-16T09:36:45+00:00" + "time": "2019-04-23T14:37:24+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5404,7 +5408,7 @@ }, { "name": "symfony/process", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -5453,16 +5457,16 @@ }, { "name": "symfony/translation", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "46c0dede1f925383d13dc783857be2c41efd0b24" + "reference": "181a426dd129cb496f12d7e7555f6d0b37a7615b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/46c0dede1f925383d13dc783857be2c41efd0b24", - "reference": "46c0dede1f925383d13dc783857be2c41efd0b24", + "url": "https://api.github.com/repos/symfony/translation/zipball/181a426dd129cb496f12d7e7555f6d0b37a7615b", + "reference": "181a426dd129cb496f12d7e7555f6d0b37a7615b", "shasum": "" }, "require": { @@ -5524,11 +5528,11 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2019-04-10T16:20:36+00:00" + "time": "2019-05-01T12:55:36+00:00" }, { "name": "symfony/yaml", - "version": "v4.2.7", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -5691,26 +5695,39 @@ }, { "name": "vaimo/webdriver-binary-downloader", - "version": "2.0.0", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/vaimo/webdriver-binary-downloader.git", - "reference": "5e7a380d3eb14b90ce001e475419bfb1305f4fc0" + "reference": "d143a64f6a5ed1cd7a34bdfad8dda5a0bb2ccb28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vaimo/webdriver-binary-downloader/zipball/5e7a380d3eb14b90ce001e475419bfb1305f4fc0", - "reference": "5e7a380d3eb14b90ce001e475419bfb1305f4fc0", + "url": "https://api.github.com/repos/vaimo/webdriver-binary-downloader/zipball/d143a64f6a5ed1cd7a34bdfad8dda5a0bb2ccb28", + "reference": "d143a64f6a5ed1cd7a34bdfad8dda5a0bb2ccb28", "shasum": "" }, "require": { "composer-plugin-api": "^1.0", - "composer/composer": "^1.0" + "composer/composer": "^1.0", + "php": ">=5.3.0" + }, + "require-dev": { + "composer/composer": "^1.0.0", + "phpcompatibility/php-compatibility": "^9.1.1", + "phpmd/phpmd": "^2.6.0", + "phpunit/phpunit": "^4.8.36", + "sebastian/phpcpd": "^1.4.3", + "squizlabs/php_codesniffer": "^2.9.2", + "vaimo/composer-changelogs": "^0.15.4" }, "type": "library", "extra": { "changelog": { - "source": "changelog.json" + "source": "changelog.json", + "output": { + "md": "CHANGELOG.md" + } } }, "autoload": { @@ -5736,7 +5753,7 @@ "downloader", "webdriver" ], - "time": "2018-12-12T19:43:27+00:00" + "time": "2019-05-02T23:06:51+00:00" }, { "name": "webflo/drupal-finder", diff --git a/config/VERSION b/config/VERSION index 4e909960f..86600095b 100644 --- a/config/VERSION +++ b/config/VERSION @@ -1 +1 @@ -v1.0.0-alpha11 +v1.0.0-alpha12 diff --git a/config/packages.yml b/config/packages.yml index 4bb87c0f4..a79d66a50 100644 --- a/config/packages.yml +++ b/config/packages.yml @@ -7,7 +7,7 @@ # its composer.json file. Defaults to "drupal-module". # - "install_path": (optional) The path the package gets installed at relative # to the fixture root, e.g., docroot/modules/contrib/example. -# Used internally for Drupal submodules. Defaults by "type" to match the +# Used internally for Drupal subextensions. Defaults by "type" to match the # "installer-paths" patterns specified by BLT. # - "url": (optional) The path, absolute or relative to the fixture root, of a # local clone of the package. Used for the "url" property of the @@ -87,11 +87,14 @@ drupal/lightning_layout: drupal/lightning_media: url: ../lightning-media - version_dev: '3.x-dev || 4.x-dev' + version_dev: '3.x-dev' drupal/lightning_workflow: url: ../lightning-workflow version_dev: '2.x-dev || 3.x-dev' +drupal/mautic: + version_dev: 1.x-dev + #drupal/media_acquiadam: # version_dev: 1.x-dev diff --git a/docs/README.md b/docs/README.md index bb36b8875..615285fe9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,10 +8,13 @@ ORCA (Official Representative Customer Application) is a tool for testing Acquia | --- | --- | | Adds all Acquia packages to a BLT project via Composer, installs them and their submodules, and runs their automated tests. | Ensures that all Acquia packages can be added to the same codebase via Composer (prevents dependency conflicts), that there are no install time or functional conflicts between them, and that they have no undocumented dependencies, and prevents regressions. | | Adds only the package under test to a BLT project via Composer, installs it and its submodules, and runs its automated tests. | Ensures that the package under test has no undeclared dependencies on other Acquia packages and functions correctly on its own. | -| Performs the above tests with the recommended, stable versions of Drupal core and Acquia packages. | Ensures that the package under still works with the versions of other software already released and in use and prevents releases of the package from disrupting the ecosystem. | -| Performs the above tests using the latest development versions of Drupal core and Acquia packages. | Ensures that the package under test will continue to work when new versions of other software are released and prevents changes in the ecosystem from breaking the package. Forces early awareness and collaboration between project teams and prevents rework and emergency support situations. | +| Performs the above tests with the recommended, stable versions of Acquia packages. | Ensures that the package under test still works with the versions of other software already released and in use and prevents releases of the package from disrupting the ecosystem. | +| Performs the above tests using the latest development versions of Acquia packages. | Ensures that the package under test will continue to work when new versions of other software are released and prevents changes in the ecosystem from breaking the package. Forces early awareness and collaboration between project teams and prevents rework and emergency support situations. | +| Performs the above tests using a threefold spread of Drupal core versions: the previous minor release, the current supported release, and the next minor dev version. | Ensures that the package under test still works with both supported releases of Drupal and will continue to work with the next one. | | Performs static analysis of the package under test. | Ensures low level construction quality. (Prevents PHP warnings and errors, version incompatibility, etc.) | +See [Continuous integration](understanding-orca.md#Continuous-integration) for exact details. + ## Documentation * [Understanding ORCA](understanding-orca.md) diff --git a/docs/advanced-usage.md b/docs/advanced-usage.md index 115b68ada..7740061c9 100644 --- a/docs/advanced-usage.md +++ b/docs/advanced-usage.md @@ -4,11 +4,37 @@ Various aspects of ORCA's behavior can be altered at runtime through the use of environment variables. These can be set or exported in a local terminal session or [in various ways on Travis CI](https://docs.travis-ci.com/user/environment-variables/). +### Command-line application + +These affect ORCA in all contexts. + * **`ORCA_FIXTURE_DIR`**: Change the directory ORCA uses for test fixtures. Acceptable values are any valid, local directory reference, e.g., `/var/www/example`, or `../example`. * **`ORCA_PACKAGES_CONFIG`**: Completely replace the list of packages ORCA installs in fixtures and runs tests on. Acceptable values are any valid path to a YAML file relative to ORCA itself, e.g., `../example/tests/packages.yml`. See [`config/packages.yml`](../config/packages.yml) for an example and explanation of the schema. -* **`ORCA_PACKAGES_CONFIG_ALTER`**: Alter the main list of package ORCA installs in fixtures and runs tests on (add, remove, or change packages and their properties). Acceptable values are any valid path to a YAML file relative to ORCA itself, e.g., `../example/tests/packages_alter.yml`. See [`.travis.yml`](../.travis.yml) and [`example/tests/packages_alter.yml`](../example/tests/packages_alter.yml) for an example and explanation of the schema. **Note:** This option should be used conservatively as it erodes the uniformity at the heart of ORCA's _representative_ nature. +* **`ORCA_PACKAGES_CONFIG_ALTER`**: Alter the main list of packages ORCA installs in fixtures and runs tests on (add, remove, or change packages and their properties). Acceptable values are any valid path to a YAML file relative to ORCA itself, e.g., `../example/tests/packages_alter.yml`. See [`.travis.yml`](../.travis.yml) and [`example/tests/packages_alter.yml`](../example/tests/packages_alter.yml) for an example and explanation of the schema. **Note:** This option should be used conservatively as it erodes the uniformity at the heart of ORCA's _representative_ nature. + +### Travis CI scripts + +These affect ORCA only as invoked via the Travis CI scripts. + +* **`ORCA_CUSTOM_FIXTURE_INIT_ARGS`**: Add command-line arguments to `fixture:init` invocation in the [`install`](../bin/travis/install.sh) build phase of a custom job. Example: + + ```yaml + matrix: + include: + - { name: "Custom job", env: ORCA_JOB=CUSTOM ORCA_CUSTOM_FIXTURE_INIT_ARGS="--profile=lightning" } + ``` + +* **`ORCA_CUSTOM_TESTS_RUN_ARGS`**: Add command-line arguments to the `tests:run` invocation in the [`script`](../bin/travis/script.sh) build phase of a custom job. Example: + + ```yaml + matrix: + include: + - { name: "Custom job", env: ORCA_JOB=CUSTOM ORCA_CUSTOM_TESTS_RUN_ARGS="--sut-only" } + ``` + +* **`ORCA_FIXTURE_PROFILE`**: Change the Drupal installation profile ORCA installs in fixtures. Note: Changing this value will cause non-SUT automated tests to be skipped in all jobs to avoid failures from changing such a fundamental assumption. --- diff --git a/docs/faq.md b/docs/faq.md index 1e47332da..e22d633cb 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -15,22 +15,22 @@ ORCA doesn't install dev dependencies because Composer provides no means of doin ## Drupal -### Why doesn't ORCA enable my submodule? +### Why doesn't ORCA enable my submodule/subtheme? -ORCA automatically discovers and enables any submodule that satisfies the following criteria: +ORCA automatically discovers and enables any subextension that satisfies the following criteria: * It exists in a subdirectory of a present package (other than `tests`). * It has a valid `composer.json`... - * with a `type` value of `drupal-module`... + * with a `type` value of `drupal-module` or `drupal-theme`... * and a vendor name of "drupal", i.e., a `name` value beginning with `drupal/`. * It has a corresponding `.info.yml` file (e.g., for a Composer `name` of `drupal/example`, `example.info.yml`). -* It doesn't explicitly opt out. See [How can I prevent ORCA from enabling my submodule?](#how-can-i-prevent-orca-from-enabling-my-submodule). +* It doesn't explicitly opt out. See [How can I prevent ORCA from enabling my submodule/subtheme?](#how-can-i-prevent-orca-from-enabling-my-submodulesubtheme). -Cf. [`\Acquia\Orca\Fixture\SubmoduleManager`](../src/Fixture/SubmoduleManager.php). +Cf. [`\Acquia\Orca\Fixture\subextensionManager`](../src/Fixture/subextensionManager.php). -### How can I prevent ORCA from enabling my submodule? +### How can I prevent ORCA from enabling my submodule/subtheme? -To prevent ORCA from enabling a submodule, add an `extra.orca.enable` value of `TRUE` to its `composer.json`, e.g.: +To prevent ORCA from enabling a subextension, add an `extra.orca.enable` value of `TRUE` to its `composer.json`, e.g.: ```json { @@ -45,7 +45,7 @@ To prevent ORCA from enabling a submodule, add an `extra.orca.enable` value of ` ``` -Cf. [Why doesn't ORCA enable my submodule?](#why-doesnt-orca-enable-my-submodule). +Cf. [Why doesn't ORCA enable my submodule/subtheme?](#why-doesnt-orca-enable-my-submodulesubtheme). --- diff --git a/docs/understanding-orca.md b/docs/understanding-orca.md index c2c5a470a..c3625f441 100644 --- a/docs/understanding-orca.md +++ b/docs/understanding-orca.md @@ -63,16 +63,15 @@ ORCA includes out-of-the-box support for Travis CI for continuous integration. T -| | #1
Static code
analysis | #2
Deprecated
code scan
of SUT only | #3
Deprecated
code scan
w/ contrib | #4
Isolated/
recommended | #5
Integrated/
recommended | #6
Integrated/
recommended/
previous core | #7
Isolated/
dev | #8
Integrated/
dev | #9
Integrated/
dev/next core
dev | -|----------------------|:---------------------------------:|:--------------------------------------------------:|:-------------------------------------------------:|:----------------------------------:|:------------------------------------:|:---------------------------------------------------------:|:--------------------------:|:----------------------------:|:-----------------------------------------------:| -| Fixture type | None | SUT-only | SUT-only | SUT-only | Standard | Standard | SUT-only | Standard | Standard | -| Package stability | n/a | Stable | Stable | Stable | Stable | Stable | Dev | Dev | Dev | -| Drupal core version | n/a | Current | Current | Current | Current | Previous
minor dev | Current | Current | Next
minor dev | -| Static analysis | :black_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | -| Deprecated code scan | :white_circle: | :black_circle: | :black_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | -| Automated tests | :white_circle: | :white_circle: | :white_circle: | :black_circle: | :black_circle: | :black_circle: | :black_circle: | :black_circle: | :black_circle: | -| Allow failure | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :black_circle: | :black_circle: | :black_circle: | - +| | #1
Static code
analysis | #2
Deprecated
code scan | #3
Isolated/
recommended | #4
Integrated/
recommended | #5
Integrated/
recommended/
previous core | #6
Isolated/
dev | #7
Integrated/
dev | #8
Integrated/
dev/next core
dev | +|----------------------|:---------------------------------:|:---------------------------------:|:----------------------------------:|:------------------------------------:|:---------------------------------------------------------:|:--------------------------:|:----------------------------:|:-----------------------------------------------:| +| Fixture type | None | SUT-only | SUT-only | Standard | Standard | SUT-only | Standard | Standard | +| Package stability | n/a | Stable | Stable | Stable | Stable | Dev | Dev | Dev | +| Drupal core version | n/a | Current | Current | Current | Previous
minor release | Current | Current | Next
minor dev | +| Static analysis | :black_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | +| Deprecated code scan | :white_circle: | :black_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | +| Automated tests | :white_circle: | :white_circle: | :black_circle: | :black_circle: | :black_circle: | :black_circle: | :black_circle: | :black_circle: | +| Allow failure | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :black_circle: | :black_circle: | :black_circle: | See [Configuring Travis CI](getting-started.md#configuring-travis-ci). --- diff --git a/example/.travis.yml b/example/.travis.yml index a4322dce8..3c5f91fcc 100644 --- a/example/.travis.yml +++ b/example/.travis.yml @@ -22,7 +22,7 @@ language: php # The lowest version of PHP supported by all of Drupal, Acquia, and ORCA itself. # @see https://www.drupal.org/docs/8/system-requirements/php-requirements # @see https://docs.acquia.com/acquia-cloud/arch/tech-platform/ -php: 7.1 +php: "7.1" addons: # ChromeDriver is used for PHPUnit tests. @@ -52,6 +52,10 @@ env: # uncommenting the following line and specifying your own alter file. # @see https://github.com/acquia/orca/blob/master/docs/advanced-usage.md#ORCA_PACKAGES_CONFIG_ALTER # - ORCA_PACKAGES_CONFIG_ALTER=../example/tests/packages_alter.yml + # If your package is a Drupal installation profile, uncomment the following + # line and specify its machine name. + # @see https://github.com/acquia/orca/blob/master/docs/advanced-usage.md#ORCA_FIXTURE_PROFILE + # - ORCA_FIXTURE_PROFILE=example # Execution time is drastically reduced by splitting the build into multiple # concurrent jobs. @@ -60,8 +64,7 @@ matrix: fast_finish: true include: - { name: "Static code analysis", env: ORCA_JOB=STATIC_CODE_ANALYSIS } - - { name: "Deprecated code scan of SUT only", env: ORCA_JOB=DEPRECATED_CODE_SCAN_SUT } - - { name: "Deprecated code scan of SUT plus contrib", env: ORCA_JOB=DEPRECATED_CODE_SCAN_CONTRIB } + - { name: "Deprecated code scan", env: ORCA_JOB=DEPRECATED_CODE_SCAN_SUT } - { name: "Isolated test w/ recommended package versions", env: ORCA_JOB=ISOLATED_RECOMMENDED } - { name: "Integrated test w/ recommended package versions", env: ORCA_JOB=INTEGRATED_RECOMMENDED } - { name: "Integrated test w/ recommended package versions & previous minor release of Drupal core", env: ORCA_JOB=CORE_PREVIOUS } @@ -72,11 +75,10 @@ matrix: # build. They should still be watched for advance notice of future problems. # @see https://docs.travis-ci.com/user/customizing-the-build#rows-that-are-allowed-to-fail allow_failures: - # Obviously, issues in third party code should not fail a build. - - env: ORCA_JOB=DEPRECATED_CODE_SCAN_CONTRIB # Dev jobs are allowed to fail due to their inherent instability. - env: ORCA_JOB=ISOLATED_DEV - env: ORCA_JOB=INTEGRATED_DEV + - env: ORCA_JOB=CORE_NEXT # Install ORCA and prepare the environment. before_install: diff --git a/example/modules/example_submodule_do_not_enable/example_submodule_do_not_enable.install b/example/modules/example_submodule_do_not_enable/example_submodule_do_not_enable.install index 7ea899c9e..fb776557d 100644 --- a/example/modules/example_submodule_do_not_enable/example_submodule_do_not_enable.install +++ b/example/modules/example_submodule_do_not_enable/example_submodule_do_not_enable.install @@ -12,5 +12,5 @@ * If run. */ function hook_example_submodule_do_not_enable_install() { - throw new \Exception('Failed to respect submodule enable opt out for test_module.'); + throw new \Exception('Failed to respect subextension enable opt out for test_module.'); } diff --git a/example/tests/modules/test_module/test_module.install b/example/tests/modules/test_module/test_module.install index ed4dc80da..bf4e5f145 100644 --- a/example/tests/modules/test_module/test_module.install +++ b/example/tests/modules/test_module/test_module.install @@ -12,5 +12,5 @@ * If run. */ function hook_test_module_install() { - throw new \Exception('Failed to exclude test module from submodule enable.'); + throw new \Exception('Failed to exclude test module from subextension enable.'); } diff --git a/src/Command/Fixture/FixtureEnableModulesCommand.php b/src/Command/Fixture/FixtureEnableExtensionsCommand.php similarity index 57% rename from src/Command/Fixture/FixtureEnableModulesCommand.php rename to src/Command/Fixture/FixtureEnableExtensionsCommand.php index bf9908ca4..4de96d95b 100644 --- a/src/Command/Fixture/FixtureEnableModulesCommand.php +++ b/src/Command/Fixture/FixtureEnableExtensionsCommand.php @@ -3,7 +3,7 @@ namespace Acquia\Orca\Command\Fixture; use Acquia\Orca\Command\StatusCodes; -use Acquia\Orca\Fixture\AcquiaModuleEnabler; +use Acquia\Orca\Fixture\AcquiaExtensionEnabler; use Acquia\Orca\Fixture\Fixture; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; @@ -12,21 +12,21 @@ /** * Provides a command. */ -class FixtureEnableModulesCommand extends Command { +class FixtureEnableExtensionsCommand extends Command { /** * The default command name. * * @var string */ - protected static $defaultName = 'fixture:enable-modules'; + protected static $defaultName = 'fixture:enable-extensions'; /** - * The Acquia module enabler. + * The Acquia extension enabler. * - * @var \Acquia\Orca\Fixture\AcquiaModuleEnabler + * @var \Acquia\Orca\Fixture\AcquiaExtensionEnabler */ - private $acquiaModuleEnabler; + private $acquiaExtensionEnabler; /** * The fixture. @@ -38,13 +38,13 @@ class FixtureEnableModulesCommand extends Command { /** * Constructs an instance. * - * @param \Acquia\Orca\Fixture\AcquiaModuleEnabler $acquia_module_enabler - * The Acquia module enabler. + * @param \Acquia\Orca\Fixture\AcquiaExtensionEnabler $acquia_extension_enabler + * The Acquia extension enabler. * @param \Acquia\Orca\Fixture\Fixture $fixture * The fixture. */ - public function __construct(AcquiaModuleEnabler $acquia_module_enabler, Fixture $fixture) { - $this->acquiaModuleEnabler = $acquia_module_enabler; + public function __construct(AcquiaExtensionEnabler $acquia_extension_enabler, Fixture $fixture) { + $this->acquiaExtensionEnabler = $acquia_extension_enabler; $this->fixture = $fixture; parent::__construct(self::$defaultName); } @@ -54,8 +54,13 @@ public function __construct(AcquiaModuleEnabler $acquia_module_enabler, Fixture */ protected function configure() { $this - ->setAliases(['enmods']) - ->setDescription('Enables all Acquia modules'); + ->setAliases([ + 'enexts', + // Backward compatibility alias. + // @todo Remove this once Lightning no longer uses it. + 'fixture:enable-modules', + ]) + ->setDescription('Enables all Acquia Drupal extensions'); } /** @@ -68,7 +73,7 @@ public function execute(InputInterface $input, OutputInterface $output): int { } try { - $this->acquiaModuleEnabler->enable(); + $this->acquiaExtensionEnabler->enable(); } catch (\Exception $e) { return StatusCodes::ERROR; diff --git a/src/Command/Fixture/FixtureInitCommand.php b/src/Command/Fixture/FixtureInitCommand.php index 61da37f20..8f79d23a2 100644 --- a/src/Command/Fixture/FixtureInitCommand.php +++ b/src/Command/Fixture/FixtureInitCommand.php @@ -124,6 +124,7 @@ protected function configure() { ->setAliases(['init']) ->setDescription('Creates the test fixture') ->setHelp('Creates a BLT-based Drupal site build, includes the system under test using Composer, optionally includes all other Acquia packages, and installs Drupal.') + ->addOption('force', 'f', InputOption::VALUE_NONE, 'If the fixture already exists, remove it first without confirmation') ->addOption('sut', NULL, InputOption::VALUE_REQUIRED, 'The system under test (SUT) in the form of its package name, e.g., "drupal/example"') ->addOption('sut-only', NULL, InputOption::VALUE_NONE, 'Add only the system under test (SUT). Omit all other non-required Acquia packages') ->addOption('core', NULL, InputOption::VALUE_REQUIRED, implode(PHP_EOL, [ @@ -137,7 +138,6 @@ protected function configure() { '- Any version string Composer understands, see https://getcomposer.org/doc/articles/versions.md', ])) ->addOption('dev', NULL, InputOption::VALUE_NONE, 'Use dev versions of Acquia packages') - ->addOption('force', 'f', InputOption::VALUE_NONE, 'If the fixture already exists, remove it first without confirmation') ->addOption('profile', NULL, InputOption::VALUE_REQUIRED, 'The Drupal installation profile to use, e.g., "lightning"', FixtureCreator::DEFAULT_PROFILE) ->addOption('no-sqlite', NULL, InputOption::VALUE_NONE, 'Use the default BLT database includes instead of SQLite') ->addOption('no-site-install', NULL, InputOption::VALUE_NONE, 'Do not install Drupal. Supersedes the "--profile" option'); diff --git a/src/Fixture/AcquiaModuleEnabler.php b/src/Fixture/AcquiaExtensionEnabler.php similarity index 53% rename from src/Fixture/AcquiaModuleEnabler.php rename to src/Fixture/AcquiaExtensionEnabler.php index eeb29dc8b..0fee3eae0 100644 --- a/src/Fixture/AcquiaModuleEnabler.php +++ b/src/Fixture/AcquiaExtensionEnabler.php @@ -8,12 +8,16 @@ use Symfony\Component\Console\Style\SymfonyStyle; /** - * Installs Acquia Drupal modules. + * Installs Acquia Drupal extensions. */ -class AcquiaModuleEnabler { +class AcquiaExtensionEnabler { use SutSettingsTrait; + private const TYPE_MODULE = 'drupal-module'; + + private const TYPE_THEME = 'drupal-theme'; + /** * The config loader. * @@ -50,11 +54,11 @@ class AcquiaModuleEnabler { private $packageManager; /** - * The submodule manager. + * The subextension manager. * - * @var \Acquia\Orca\Fixture\SubmoduleManager + * @var \Acquia\Orca\Fixture\SubextensionManager */ - private $submoduleManager; + private $subextensionManager; /** * Constructs an instance. @@ -69,26 +73,26 @@ class AcquiaModuleEnabler { * The process runner. * @param \Acquia\Orca\Fixture\PackageManager $package_manager * The package manager. - * @param \Acquia\Orca\Fixture\SubmoduleManager $submodule_manager - * The submodule manager. + * @param \Acquia\Orca\Fixture\SubextensionManager $subextension_manager + * The subextension manager. */ - public function __construct(ConfigLoader $config_loader, Fixture $fixture, SymfonyStyle $output, ProcessRunner $process_runner, PackageManager $package_manager, SubmoduleManager $submodule_manager) { + public function __construct(ConfigLoader $config_loader, Fixture $fixture, SymfonyStyle $output, ProcessRunner $process_runner, PackageManager $package_manager, SubextensionManager $subextension_manager) { $this->configLoader = $config_loader; $this->fixture = $fixture; $this->output = $output; $this->processRunner = $process_runner; $this->packageManager = $package_manager; - $this->submoduleManager = $submodule_manager; + $this->subextensionManager = $subextension_manager; } /** - * Enables modules. + * Enables extensions. * * @throws \Exception */ public function enable(): void { $this->getSutSettingsFromFixture(); - $this->enableAcquiaModules(); + $this->enableAcquiaExtensions(); } /** @@ -103,31 +107,61 @@ private function getSutSettingsFromFixture(): void { } /** - * Enables the Acquia modules. + * Enables the Acquia extensions. */ - private function enableAcquiaModules(): void { - if ($this->isSutOnly && ($this->sut->getType() !== 'drupal-module')) { - $this->output->warning('No modules to enable because the fixture is SUT-only and the SUT is not a Drupal module'); + private function enableAcquiaExtensions(): void { + if ($this->isSutOnly && !$this->sut->isDrupalExtension()) { + $this->output->warning('No extensions to enable because the fixture is SUT-only and the SUT is not a Drupal extension'); return; } - $this->output->section('Enabling Acquia modules'); - $module_list = $this->getAcquiaModuleList(); + $this->output->section('Enabling Acquia modules & themes'); + $this->enableModules(); + $this->enableThemes(); + } + + /** + * Enables the Acquia modules. + */ + private function enableModules(): void { + $module_list = $this->getAcquiaExtensionList(self::TYPE_MODULE); + if (!$module_list) { + return; + } $this->processRunner->runFixtureVendorBin(array_merge([ 'drush', - 'pm-enable', + 'pm:enable', '--yes', ], $module_list)); } /** - * Gets the list of Acquia modules to enable. + * Enables the Acquia themes. + */ + private function enableThemes(): void { + $theme_list = $this->getAcquiaExtensionList(self::TYPE_THEME); + if (!$theme_list) { + return; + } + $this->processRunner->runFixtureVendorBin([ + 'drush', + 'theme:enable', + '--yes', + implode(',', $theme_list), + ]); + } + + /** + * Gets the list of Acquia extensions to enable. + * + * @param string $extension_type + * The extension type: ::TYPE_MODULE or ::TYPE_THEME. * * @return string[] - * An indexed array of Acquia module machine names. + * An indexed array of Acquia extension machine names. */ - private function getAcquiaModuleList(): array { - $module_list = []; + private function getAcquiaExtensionList(string $extension_type): array { + $extension_list = []; $top_level_packages = $this->packageManager->getMultiple(); if ($this->isSutOnly) { @@ -135,19 +169,23 @@ private function getAcquiaModuleList(): array { } foreach ($top_level_packages as $package) { - if ($package->getType() === 'drupal-module') { - $module_list[] = $package->getProjectName(); + if ($package->getType() === $extension_type) { + $extension_list[] = $package->getProjectName(); + } + + if (!$package->isDrupalExtension()) { + continue; } - foreach ($this->submoduleManager->getByParent($package) as $submodule) { - if (!$submodule->shouldGetEnabled()) { + foreach ($this->subextensionManager->getByParent($package) as $subextension) { + if ($subextension->getType() !== $extension_type || !$subextension->shouldGetEnabled()) { continue; } - $module_list[] = $submodule->getProjectName(); + $extension_list[] = $subextension->getProjectName(); } } - return $module_list; + return $extension_list; } } diff --git a/src/Fixture/FixtureCreator.php b/src/Fixture/FixtureCreator.php index 80101783e..eda5fea98 100644 --- a/src/Fixture/FixtureCreator.php +++ b/src/Fixture/FixtureCreator.php @@ -22,11 +22,11 @@ class FixtureCreator { const DEFAULT_PROFILE = 'minimal'; /** - * The Acquia module enabler. + * The Acquia extension enabler. * - * @var \Acquia\Orca\Fixture\AcquiaModuleEnabler + * @var \Acquia\Orca\Fixture\AcquiaExtensionEnabler */ - private $acquiaModuleEnabler; + private $acquiaExtensionEnabler; /** * The Drupal core version override. @@ -106,11 +106,11 @@ class FixtureCreator { private $profile = self::DEFAULT_PROFILE; /** - * The submodule manager. + * The subextension manager. * - * @var \Acquia\Orca\Fixture\SubmoduleManager + * @var \Acquia\Orca\Fixture\SubextensionManager */ - private $submoduleManager; + private $subextensionManager; /** * The SQLite flag. @@ -129,8 +129,8 @@ class FixtureCreator { /** * Constructs an instance. * - * @param \Acquia\Orca\Fixture\AcquiaModuleEnabler $acquia_module_enabler - * The Acquia module enabler. + * @param \Acquia\Orca\Fixture\AcquiaExtensionEnabler $acquia_extension_enabler + * The Acquia extension enabler. * @param \Acquia\Orca\Fixture\Fixture $fixture * The fixture. * @param \Acquia\Orca\Fixture\FixtureInspector $fixture_inspector @@ -141,19 +141,19 @@ class FixtureCreator { * The process runner. * @param \Acquia\Orca\Fixture\PackageManager $package_manager * The package manager. - * @param \Acquia\Orca\Fixture\SubmoduleManager $submodule_manager - * The submodule manager. + * @param \Acquia\Orca\Fixture\SubextensionManager $subextension_manager + * The subextension manager. * @param \Composer\Package\Version\VersionGuesser $version_guesser * The Composer version guesser. */ - public function __construct(AcquiaModuleEnabler $acquia_module_enabler, Fixture $fixture, FixtureInspector $fixture_inspector, SymfonyStyle $output, ProcessRunner $process_runner, PackageManager $package_manager, SubmoduleManager $submodule_manager, VersionGuesser $version_guesser) { - $this->acquiaModuleEnabler = $acquia_module_enabler; + public function __construct(AcquiaExtensionEnabler $acquia_extension_enabler, Fixture $fixture, FixtureInspector $fixture_inspector, SymfonyStyle $output, ProcessRunner $process_runner, PackageManager $package_manager, SubextensionManager $subextension_manager, VersionGuesser $version_guesser) { + $this->acquiaExtensionEnabler = $acquia_extension_enabler; $this->fixture = $fixture; $this->fixtureInspector = $fixture_inspector; $this->output = $output; $this->processRunner = $process_runner; $this->packageManager = $package_manager; - $this->submoduleManager = $submodule_manager; + $this->subextensionManager = $subextension_manager; $this->versionGuesser = $version_guesser; } @@ -173,7 +173,7 @@ public function create(): void { $this->installCloudHooks(); $this->ensureDrupalSettings(); $this->installDrupal(); - $this->enableAcquiaModules(); + $this->enableAcquiaExtensions(); $this->createAndCheckoutBackupTag(); $this->displayStatus(); } @@ -393,7 +393,7 @@ private function getUnwantedPackageList(): array { private function addAcquiaPackages(): void { $this->output->section('Adding Acquia packages'); $this->addTopLevelAcquiaPackages(); - $this->addSutSubmodules(); + $this->addSutSubextensions(); $this->addComposerExtraData(); $this->commitCodeChanges('Added Acquia packages.'); } @@ -572,38 +572,38 @@ private function getSutPackageString(): string { } /** - * Adds submodules of the SUT to composer.json. + * Adds subextensions of the SUT to composer.json. */ - private function addSutSubmodules(): void { - if (!$this->sut || !$this->submoduleManager->getAll()) { + private function addSutSubextensions(): void { + if (!$this->sut || !$this->subextensionManager->getAll()) { return; } - $this->configureComposerForSutSubmodules(); - $this->composerRequireSutSubmodules(); + $this->configureComposerForSutSubextensions(); + $this->composerRequireSutSubextensions(); } /** - * Configures Composer to find and place submodules of the SUT. + * Configures Composer to find and place subextensions of the SUT. */ - private function configureComposerForSutSubmodules(): void { + private function configureComposerForSutSubextensions(): void { $this->loadComposerJson(); - $this->addSutSubmoduleRepositories(); - $this->addInstallerPathsForSutSubmodules(); + $this->addSutSubextensionRepositories(); + $this->addInstallerPathsForSutSubextensions(); } /** - * Adds Composer repositories for submodules of the SUT. + * Adds Composer repositories for subextensions of the SUT. * * Repositories take precedence in the order specified (i.e., first match * found wins), so our override needs to be added to the beginning in order * to take effect. */ - private function addSutSubmoduleRepositories(): void { + private function addSutSubextensionRepositories(): void { // Remove original repositories. $this->jsonConfigSource->removeProperty('repositories'); // Add new repositories. - foreach ($this->submoduleManager->getByParent($this->sut) as $package) { + foreach ($this->subextensionManager->getByParent($this->sut) as $package) { $this->jsonConfigSource->addRepository($package->getPackageName(), [ 'type' => 'path', 'url' => $package->getRepositoryUrl(), @@ -617,17 +617,17 @@ private function addSutSubmoduleRepositories(): void { } /** - * Adds installer-paths for submodules of the SUT. + * Adds installer-paths for subextensions of the SUT. */ - private function addInstallerPathsForSutSubmodules(): void { + private function addInstallerPathsForSutSubextensions(): void { // Installer paths seem to be applied in the order specified, so overrides // need to be added to the beginning in order to take effect. Begin by // removing the original installer paths. $this->jsonConfigSource->removeProperty('extra.installer-paths'); // Add new installer paths. - $package_names = array_keys($this->submoduleManager->getByParent($this->sut)); - // Submodules are implicitly installed with their parent modules, and + $package_names = array_keys($this->subextensionManager->getByParent($this->sut)); + // Subextensions are implicitly installed with their parent modules, and // Composer won't allow them to be placed in the same location via their // separate packages to be placed in the same location. Neither will it // allow them to be "installed" outside the repository, in the system temp @@ -644,11 +644,11 @@ private function addInstallerPathsForSutSubmodules(): void { } /** - * Requires the Acquia submodules via Composer. + * Requires the Acquia subextensions via Composer. */ - private function composerRequireSutSubmodules(): void { + private function composerRequireSutSubextensions(): void { $packages = []; - foreach (array_keys($this->submoduleManager->getByParent($this->sut)) as $package_name) { + foreach (array_keys($this->subextensionManager->getByParent($this->sut)) as $package_name) { $packages[] = "{$package_name}:@dev"; } $this->processRunner->runOrcaVendorBin(array_merge([ @@ -771,7 +771,7 @@ private function installDrupal(): void { $this->output->section('Installing Drupal'); $this->processRunner->runFixtureVendorBin([ 'drush', - 'site-install', + 'site:install', $this->profile, "install_configure_form.update_status_module='[FALSE,FALSE]'", 'install_configure_form.enable_update_status_module=NULL', @@ -786,23 +786,23 @@ private function installDrupal(): void { } /** - * Enables the Acquia Drupal modules. + * Enables the Acquia Drupal extensions. * * @throws \Exception */ - private function enableAcquiaModules(): void { + private function enableAcquiaExtensions(): void { if (!$this->installSite) { return; } - if ($this->isSutOnly && ($this->sut->getType() !== 'drupal-module')) { - // No modules to enable because the fixture is SUT-only and the SUT is not - // a Drupal module. + if ($this->isSutOnly && !$this->sut->isDrupalExtension()) { + // No extensions to enable because the fixture is SUT-only and the SUT is + // not a Drupal extension. return; } - $this->acquiaModuleEnabler->enable(); - $this->commitCodeChanges('Enabled Acquia modules.'); + $this->acquiaExtensionEnabler->enable(); + $this->commitCodeChanges('Enabled Acquia extensions.'); } /** diff --git a/src/Fixture/Package.php b/src/Fixture/Package.php index 5cdfe3e95..3f5cf9c6d 100644 --- a/src/Fixture/Package.php +++ b/src/Fixture/Package.php @@ -44,7 +44,7 @@ class Package { * property in its composer.json file. Defaults to "drupal-module". * - "install_path": (optional) The path the package gets installed at * relative to the fixture root, e.g., docroot/modules/contrib/example. - * Used for Drupal submodules. Defaults by "type" to match the + * Used for Drupal subextensions. Defaults by "type" to match the * "installer-paths" patterns specified by BLT. * - "url": (optional) The path, absolute or relative to the fixture root, * of a local clone of the package. Used for the "url" property of the @@ -235,15 +235,45 @@ public function getVersionRecommended(): string { return $this->data['version']; } + /** + * Determines whether the package is a Drupal extension. + * + * @return bool + * Returns TRUE if it is, or FALSE if not. + */ + public function isDrupalExtension(): bool { + return $this->isDrupalModule() || $this->isDrupalTheme(); + } + + /** + * Determines whether the package is a Drupal module. + * + * @return bool + * Returns TRUE if it is, or FALSE if not. + */ + public function isDrupalModule(): bool { + return $this->getType() === 'drupal-module'; + } + + /** + * Determines whether the package is a Drupal theme. + * + * @return bool + * Returns TRUE if it is, or FALSE if not. + */ + public function isDrupalTheme(): bool { + return $this->getType() === 'drupal-theme'; + } + /** * Determines whether the package is a Drupal module that should get enabled. * * @return bool - * TRUE if the package is a Drupal module that should get enabled or FALSE - * if not. + * TRUE if the package is a Drupal extension that should get enabled or + * FALSE if not. */ public function shouldGetEnabled(): bool { - if ($this->getType() !== 'drupal-module') { + if (!$this->isDrupalExtension()) { return FALSE; } diff --git a/src/Fixture/SubmoduleManager.php b/src/Fixture/SubextensionManager.php similarity index 59% rename from src/Fixture/SubmoduleManager.php rename to src/Fixture/SubextensionManager.php index 479a1f08c..c26668e0d 100644 --- a/src/Fixture/SubmoduleManager.php +++ b/src/Fixture/SubextensionManager.php @@ -8,9 +8,9 @@ use Symfony\Component\Finder\Finder; /** - * Provide access to Acquia Drupal submodules physically in the fixture. + * Provide access to Acquia Drupal subextensions physically in the fixture. */ -class SubmoduleManager { +class SubextensionManager { /** * The config loader. @@ -34,18 +34,18 @@ class SubmoduleManager { private $fixture; /** - * The top-level Acquia modules. + * The top-level Acquia extensions. * * @var \Acquia\Orca\Fixture\Package[] */ - private $topLevelModules; + private $topLevelExtensions; /** - * The submodules found in the fixture. + * The subextensions found in the fixture. * * @var \Acquia\Orca\Fixture\Package[] */ - private $submodules = []; + private $subextensions = []; /** * Constructs an instance. @@ -63,29 +63,32 @@ public function __construct(ConfigLoader $config_loader, Filesystem $filesystem, $this->configLoader = $config_loader; $this->filesystem = $filesystem; $this->fixture = $fixture; - $this->topLevelModules = $package_manager->getMultiple('drupal-module'); + $this->topLevelExtensions = array_merge( + $package_manager->getMultiple('drupal-module'), + $package_manager->getMultiple('drupal-theme') + ); } /** - * Gets an array of all Acquia submodules. + * Gets an array of all Acquia subextensions. * * @return \Acquia\Orca\Fixture\Package[] * An indexed array of package objects. */ public function getAll(): array { - if ($this->submodules) { - return $this->submodules; + if ($this->subextensions) { + return $this->subextensions; } - $paths = $this->getTopLevelModuleInstallPaths(); - $this->submodules = $this->getInPaths($paths); - return $this->submodules; + $paths = $this->getTopLevelExtensionInstallPaths(); + $this->subextensions = $this->getInPaths($paths); + return $this->subextensions; } /** - * Gets an array of submodules of a given parent. + * Gets an array of subextensions of a given parent. * * @param \Acquia\Orca\Fixture\Package $package - * The package to search for submodules. + * The package to search for subextensions. * * @return \Acquia\Orca\Fixture\Package[] * An indexed array of package objects. @@ -96,17 +99,17 @@ public function getByParent(Package $package): array { } /** - * Gets an array of submodules in a given set of paths. + * Gets an array of subextensions in a given set of paths. * * @param string[] $paths - * The paths to search for submodules. + * The paths to search for subextensions. * * @return \Acquia\Orca\Fixture\Package[] * An indexed array of package objects. */ public function getInPaths(array $paths): array { - $submodules = []; - foreach ($this->findSubmoduleComposerJsonFiles($paths) as $file) { + $subextensions = []; + foreach ($this->findSubextensionComposerJsonFiles($paths) as $file) { try { $config = $this->configLoader->load($file->getPathname()); } @@ -116,35 +119,36 @@ public function getInPaths(array $paths): array { $name = $config->get('name'); $install_path = str_replace("{$this->fixture->getPath()}/", '', $file->getPath()); $package_data = [ + 'type' => $config->get('type'), 'install_path' => $install_path, 'url' => $file->getPath(), 'version' => '@dev', 'version_dev' => '@dev', - 'enable' => $this->shouldModuleGetEnabled($config, $install_path), + 'enable' => $this->shouldExtensionGetEnabled($config, $install_path), ]; - $submodules[$name] = new Package($this->fixture, $name, $package_data); + $subextensions[$name] = new Package($this->fixture, $name, $package_data); } - return $submodules; + return $subextensions; } /** - * Determines whether or not the given submodule should get enabled. + * Determines whether or not the given subextension should get enabled. * - * Test modules are never enabled because Drush cannot find them to enable. - * Standard modules are enabled unless they opt out by setting + * Test extensions are never enabled because Drush cannot find them to enable. + * Standard extensions are enabled unless they opt out by setting * extra.orca.enable to FALSE in their composer.json. * * @param \Noodlehaus\Config $config - * The submodule's composer.json config. + * The subextension's composer.json config. * @param string $install_path - * The path the module installs at. + * The path the extension installs at. * * @return bool - * TRUE if the submodule should be enabled or FALSE if not. + * TRUE if the subextension should be enabled or FALSE if not. */ - private function shouldModuleGetEnabled(Config $config, $install_path): bool { - $is_test_module = (strpos($install_path, '/tests/') !== FALSE); - if ($is_test_module) { + private function shouldExtensionGetEnabled(Config $config, $install_path): bool { + $is_test_extension = (strpos($install_path, '/tests/') !== FALSE); + if ($is_test_extension) { return FALSE; } @@ -152,14 +156,14 @@ private function shouldModuleGetEnabled(Config $config, $install_path): bool { } /** - * Gets an array of top level module install paths. + * Gets an array of top level extension install paths. * * @return string[] * An indexed array of paths. */ - private function getTopLevelModuleInstallPaths(): array { + private function getTopLevelExtensionInstallPaths(): array { $paths = []; - foreach ($this->topLevelModules as $package) { + foreach ($this->topLevelExtensions as $package) { $path = $package->getInstallPathAbsolute(); if ($this->filesystem->exists($path)) { $paths[] = $path; @@ -169,16 +173,16 @@ private function getTopLevelModuleInstallPaths(): array { } /** - * Finds all Acquia Drupal submodule composer.json files. + * Finds all Acquia Drupal subextension composer.json files. * * @param string[] $paths - * An array of paths to recursively search for submodules. + * An array of paths to recursively search for subextensions. * * @return \Symfony\Component\Finder\Finder|array - * A Finder query for all Acquia Drupal submodule composer.json files within - * the given paths or an empty array if no paths are given. + * A Finder query for all Acquia Drupal subextension composer.json files + * within the given paths or an empty array if no paths are given. */ - private function findSubmoduleComposerJsonFiles(array $paths) { + private function findSubextensionComposerJsonFiles(array $paths) { if (!$paths) { return []; } @@ -195,21 +199,21 @@ private function findSubmoduleComposerJsonFiles(array $paths) { ]) ->name('composer.json') ->filter(function (\SplFileInfo $file) { - return $this->isSubmoduleComposerJson($file); + return $this->isSubextensionComposerJson($file); }); } /** - * Determines whether a given composer.json file belongs to a submodule. + * Determines whether a given composer.json file belongs to a subextension. * * @param \SplFileInfo $file * The file to examine. * * @return bool - * TRUE if the given composer.json file belongs to a submodule or FALSE if - * not. + * TRUE if the given composer.json file belongs to a subextension or FALSE + * if not. */ - private function isSubmoduleComposerJson(\SplFileInfo $file): bool { + private function isSubextensionComposerJson(\SplFileInfo $file): bool { try { $config = $this->configLoader->load($file->getPathname()); $name = $config->get('name'); @@ -222,17 +226,17 @@ private function isSubmoduleComposerJson(\SplFileInfo $file): bool { return FALSE; } - // Ignore everything but Drupal modules. - if ($config->get('type') !== 'drupal-module') { + // Ignore everything but Drupal extensions. + if (!in_array($config->get('type'), ['drupal-module', 'drupal-theme'])) { return FALSE; } - // Ignore modules that aren't under the "drupal" vendor name. + // Ignore extensions that aren't under the "drupal" vendor name. if ($vendor_name !== 'drupal') { return FALSE; } - // Ignore modules without a corresponding .info.yml file. + // Ignore extensions without a corresponding .info.yml file. $info_yml_file = "{$file->getPath()}/{$package_name}.info.yml"; if (!$this->filesystem->exists($info_yml_file)) { return FALSE; diff --git a/src/Task/DeprecatedCodeScanner/PhpStanTask.php b/src/Task/DeprecatedCodeScanner/PhpStanTask.php index 2d4d20655..e7e19506c 100644 --- a/src/Task/DeprecatedCodeScanner/PhpStanTask.php +++ b/src/Task/DeprecatedCodeScanner/PhpStanTask.php @@ -89,9 +89,9 @@ public function execute(): int { $command[] = $this->sut->getInstallPathAbsolute(); } if ($this->scanContrib) { - $command[] = $this->getsAndEnsurePath('docroot/modules/contrib'); - $command[] = $this->getsAndEnsurePath('docroot/profiles/contrib'); - $command[] = $this->getsAndEnsurePath('docroot/themes/contrib'); + $command[] = $this->getAndEnsurePath('docroot/modules/contrib'); + $command[] = $this->getAndEnsurePath('docroot/profiles/contrib'); + $command[] = $this->getAndEnsurePath('docroot/themes/contrib'); } $this->processRunner->runOrcaVendorBin($command, $this->fixture->getPath()); } @@ -110,7 +110,7 @@ public function execute(): int { * @return string * The absolute path. */ - private function getsAndEnsurePath(string $path): string { + private function getAndEnsurePath(string $path): string { $absolute_path = $this->fixture->getPath($path); $this->filesystem->mkdir($absolute_path); return $absolute_path; diff --git a/src/Task/StaticAnalysisTool/ComposerValidateTask.php b/src/Task/StaticAnalysisTool/ComposerValidateTask.php index cf63a9db5..42e135bfe 100644 --- a/src/Task/StaticAnalysisTool/ComposerValidateTask.php +++ b/src/Task/StaticAnalysisTool/ComposerValidateTask.php @@ -118,6 +118,8 @@ private function normalize(string $path): void { '--ansi', 'normalize', '--dry-run', + '--indent-size=4', + '--indent-style=space', $path, // The cwd must be the ORCA project directory in order for Composer to // find the "normalize" command. diff --git a/tests/Command/Fixture/FixtureEnableModulesCommandTest.php b/tests/Command/Fixture/FixtureEnableExtensionsCommandTest.php similarity index 65% rename from tests/Command/Fixture/FixtureEnableModulesCommandTest.php rename to tests/Command/Fixture/FixtureEnableExtensionsCommandTest.php index 767057ba8..e00c7e46d 100644 --- a/tests/Command/Fixture/FixtureEnableModulesCommandTest.php +++ b/tests/Command/Fixture/FixtureEnableExtensionsCommandTest.php @@ -2,24 +2,23 @@ namespace Acquia\Orca\Tests\Command\Fixture; -use Acquia\Orca\Command\Fixture\FixtureEnableModulesCommand; +use Acquia\Orca\Command\Fixture\FixtureEnableExtensionsCommand; use Acquia\Orca\Command\StatusCodes; -use Acquia\Orca\Command\Fixture\FixtureRmCommand; use Acquia\Orca\Exception\OrcaException; -use Acquia\Orca\Fixture\AcquiaModuleEnabler; +use Acquia\Orca\Fixture\AcquiaExtensionEnabler; use Acquia\Orca\Fixture\Fixture; use Acquia\Orca\Tests\Command\CommandTestBase; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; /** - * @property \Prophecy\Prophecy\ObjectProphecy|AcquiaModuleEnabler $acquiaModuleEnabler + * @property \Prophecy\Prophecy\ObjectProphecy|AcquiaExtensionEnabler $acquiaModuleEnabler * @property \Prophecy\Prophecy\ObjectProphecy|\Acquia\Orca\Fixture\Fixture $fixture */ -class FixtureEnableModulesCommandTest extends CommandTestBase { +class FixtureEnableExtensionsCommandTest extends CommandTestBase { protected function setUp() { - $this->acquiaModuleEnabler = $this->prophesize(AcquiaModuleEnabler::class); + $this->acquiaModuleEnabler = $this->prophesize(AcquiaExtensionEnabler::class); $this->fixture = $this->prophesize(Fixture::class); $this->fixture->exists() ->willReturn(TRUE); @@ -45,7 +44,7 @@ public function testCommand($fixture_exists, $install_called, $exception, $statu } $tester = $this->createCommandTester(); - $this->executeCommand($tester, FixtureRmCommand::getDefaultName()); + $this->executeCommand($tester, FixtureEnableExtensionsCommand::getDefaultName()); $this->assertEquals($display, $tester->getDisplay(), 'Displayed correct output.'); $this->assertEquals($status_code, $tester->getStatusCode(), 'Returned correct status code.'); @@ -61,14 +60,14 @@ public function providerCommand() { private function createCommandTester(): CommandTester { $application = new Application(); - /** @var \Acquia\Orca\Fixture\AcquiaModuleEnabler $acquia_module_enabler */ - $acquia_module_enabler = $this->acquiaModuleEnabler->reveal(); + /** @var \Acquia\Orca\Fixture\AcquiaExtensionEnabler $acquia_extension_enabler */ + $acquia_extension_enabler = $this->acquiaModuleEnabler->reveal(); /** @var \Acquia\Orca\Fixture\Fixture $fixture */ $fixture = $this->fixture->reveal(); - $application->add(new FixtureEnableModulesCommand($acquia_module_enabler, $fixture)); - /** @var \Acquia\Orca\Command\Fixture\FixtureEnableModulesCommand $command */ - $command = $application->find(FixtureEnableModulesCommand::getDefaultName()); - $this->assertInstanceOf(FixtureEnableModulesCommand::class, $command, 'Instantiated class.'); + $application->add(new FixtureEnableExtensionsCommand($acquia_extension_enabler, $fixture)); + /** @var \Acquia\Orca\Command\Fixture\FixtureEnableExtensionsCommand $command */ + $command = $application->find(FixtureEnableExtensionsCommand::getDefaultName()); + $this->assertInstanceOf(FixtureEnableExtensionsCommand::class, $command, 'Instantiated class.'); return new CommandTester($command); } diff --git a/tests/Fixture/SubmoduleManagerTest.php b/tests/Fixture/SubextensionManagerTest.php similarity index 80% rename from tests/Fixture/SubmoduleManagerTest.php rename to tests/Fixture/SubextensionManagerTest.php index 09d39d569..1b928773c 100644 --- a/tests/Fixture/SubmoduleManagerTest.php +++ b/tests/Fixture/SubextensionManagerTest.php @@ -4,7 +4,7 @@ use Acquia\Orca\Fixture\Fixture; use Acquia\Orca\Fixture\PackageManager; -use Acquia\Orca\Fixture\SubmoduleManager; +use Acquia\Orca\Fixture\SubextensionManager; use Acquia\Orca\Utility\ConfigLoader; use PHPUnit\Framework\TestCase; use Symfony\Component\Filesystem\Filesystem; @@ -15,7 +15,7 @@ * @property \Prophecy\Prophecy\ObjectProphecy|\Symfony\Component\Filesystem\Filesystem $filesystem * @property \Prophecy\Prophecy\ObjectProphecy|\Acquia\Orca\Utility\ConfigLoader $configLoader */ -class SubmoduleManagerTest extends TestCase { +class SubextensionManagerTest extends TestCase { protected function setUp() { $this->configLoader = $this->prophesize(ConfigLoader::class); @@ -34,11 +34,14 @@ public function testConstruction() { $this->packageManager ->getMultiple('drupal-module') ->willReturn([]); + $this->packageManager + ->getMultiple('drupal-theme') + ->willReturn([]); /** @var \Acquia\Orca\Fixture\PackageManager $package_manager */ $package_manager = $this->packageManager->reveal(); - $object = new SubmoduleManager($config_loader, $filesystem, $fixture, $package_manager); + $object = new SubextensionManager($config_loader, $filesystem, $fixture, $package_manager); - $this->assertInstanceOf(SubmoduleManager::class, $object, 'Instantiated class.'); + $this->assertInstanceOf(SubextensionManager::class, $object, 'Instantiated class.'); } }