From c315b23b02915995e87b38b7b79af8fad2113962 Mon Sep 17 00:00:00 2001 From: Steffen Schlaer Date: Tue, 10 Aug 2021 15:03:27 +0200 Subject: [PATCH] Fix: Optimise deprecation stage (#50) * add file exists check for phpstan.neon file and move output into general if statement * fix: add missing slash in file exists check --- lib/stages/deprecation.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/stages/deprecation.sh b/lib/stages/deprecation.sh index 6fe6701..133da16 100644 --- a/lib/stages/deprecation.sh +++ b/lib/stages/deprecation.sh @@ -1,16 +1,19 @@ #!/usr/bin/env bash _stage_deprecation() { - printf "Checking for deprecations.\n\n" + if ${DRUPAL_TESTING_TEST_DEPRECATION}; then + printf "Checking for deprecations.\n\n" - local project_location - local composer_bin_dir + local project_location + local composer_bin_dir - project_location=$(get_project_location) - composer_bin_dir=$(get_composer_bin_directory) + project_location=$(get_project_location) + composer_bin_dir=$(get_composer_bin_directory) + + if [ ! -f "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}/phpstan.neon" ]; then + cp phpstan.neon "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + fi - if ${DRUPAL_TESTING_TEST_DEPRECATION}; then - cp phpstan.neon "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" cd "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" || exit "${composer_bin_dir}/phpstan" analyse --memory-limit "${PHPSTAN_MEMORY_LIMIT}" "${project_location}" cd - || exit