From 89ccd38df50fde48d99c9d5b29a8fefeaa75a1ef Mon Sep 17 00:00:00 2001 From: Derek Herman Date: Thu, 3 Mar 2016 22:21:54 -0800 Subject: [PATCH 1/5] Add support for theme unit testing --- check-diff.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/check-diff.sh b/check-diff.sh index 82a9726..eb02b60 100755 --- a/check-diff.sh +++ b/check-diff.sh @@ -555,8 +555,8 @@ function run_phpunit_travisci { echo "Skipping PHPUnit as requested via DEV_LIB_SKIP" return fi - if [ "$PROJECT_TYPE" != plugin ] && [ "$PROJECT_TYPE" != site ]; then - echo "Skipping PHPUnit since only applicable to site or plugin project types" + if [ "$PROJECT_TYPE" != plugin ] && [ "$PROJECT_TYPE" != site ] && [ "$PROJECT_TYPE" != theme ]; then + echo "Skipping PHPUnit since only applicable to site, theme or plugin project types" return fi echo @@ -588,6 +588,15 @@ function run_phpunit_travisci { rsync -a $(verbose_arg) --exclude .git/hooks --delete "$PROJECT_DIR/" "$INSTALL_PATH/" cd "$INSTALL_PATH" + echo "Location: $INSTALL_PATH" + elif [ "$PROJECT_TYPE" == theme ]; then + INSTALL_PATH="$WP_CORE_DIR/src/wp-content/themes/$PROJECT_SLUG" + + # Rsync the files into the right location + mkdir -p "$INSTALL_PATH" + rsync -a $(verbose_arg) --exclude .git/hooks --delete "$PROJECT_DIR/" "$INSTALL_PATH/" + cd "$INSTALL_PATH" + echo "Location: $INSTALL_PATH" elif [ "$PROJECT_TYPE" == site ]; then cd "$PROJECT_DIR" From fcd153f03b6474e5270fa907ebf9f3e8073c23a4 Mon Sep 17 00:00:00 2001 From: Derek Herman Date: Thu, 3 Mar 2016 23:40:00 -0800 Subject: [PATCH 2/5] Clone the theme dependencies --- check-diff.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/check-diff.sh b/check-diff.sh index eb02b60..468d405 100755 --- a/check-diff.sh +++ b/check-diff.sh @@ -597,6 +597,16 @@ function run_phpunit_travisci { rsync -a $(verbose_arg) --exclude .git/hooks --delete "$PROJECT_DIR/" "$INSTALL_PATH/" cd "$INSTALL_PATH" + # Clone the theme dependencies (i.e. plugins) into the plugins directory + if [ ! -z "$THEME_DEPS" ]; then + IFS=',' read -r -a dependencies <<< "$THEME_DEPS" + for dep in "${dependencies[@]}" + do + filename=$(basename "$dep") + git clone "$dep $WP_CORE_DIR/src/wp-content/plugins/${filename%.*}" + done + fi + echo "Location: $INSTALL_PATH" elif [ "$PROJECT_TYPE" == site ]; then cd "$PROJECT_DIR" From 3b946b8daaa0ffb76c1fec851d3fc2faf1bcbe1c Mon Sep 17 00:00:00 2001 From: Derek Herman Date: Thu, 3 Mar 2016 23:46:21 -0800 Subject: [PATCH 3/5] Separate vars --- check-diff.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check-diff.sh b/check-diff.sh index 468d405..e8bfb25 100755 --- a/check-diff.sh +++ b/check-diff.sh @@ -603,7 +603,7 @@ function run_phpunit_travisci { for dep in "${dependencies[@]}" do filename=$(basename "$dep") - git clone "$dep $WP_CORE_DIR/src/wp-content/plugins/${filename%.*}" + git clone "$dep" "$WP_CORE_DIR/src/wp-content/plugins/${filename%.*}" done fi From 9bed86125947897a2920157ef8c1fbdf183bcfd8 Mon Sep 17 00:00:00 2001 From: Derek Herman Date: Tue, 15 Aug 2017 17:00:50 -0700 Subject: [PATCH 4/5] Make CR changes --- check-diff.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/check-diff.sh b/check-diff.sh index e8bfb25..7294ae0 100755 --- a/check-diff.sh +++ b/check-diff.sh @@ -585,7 +585,7 @@ function run_phpunit_travisci { # Rsync the files into the right location mkdir -p "$INSTALL_PATH" - rsync -a $(verbose_arg) --exclude .git/hooks --delete "$PROJECT_DIR/" "$INSTALL_PATH/" + rsync -a $(verbose_arg) --exclude .git --delete "$PROJECT_DIR/" "$INSTALL_PATH/" cd "$INSTALL_PATH" echo "Location: $INSTALL_PATH" @@ -594,12 +594,12 @@ function run_phpunit_travisci { # Rsync the files into the right location mkdir -p "$INSTALL_PATH" - rsync -a $(verbose_arg) --exclude .git/hooks --delete "$PROJECT_DIR/" "$INSTALL_PATH/" + rsync -a $(verbose_arg) --exclude .git --delete "$PROJECT_DIR/" "$INSTALL_PATH/" cd "$INSTALL_PATH" # Clone the theme dependencies (i.e. plugins) into the plugins directory - if [ ! -z "$THEME_DEPS" ]; then - IFS=',' read -r -a dependencies <<< "$THEME_DEPS" + if [ ! -z "$THEME_GIT_PLUGIN_DEPENDENCIES" ]; then + IFS=',' read -r -a dependencies <<< "$THEME_GIT_PLUGIN_DEPENDENCIES" for dep in "${dependencies[@]}" do filename=$(basename "$dep") From d71c83db49b551f578173b280cae76b058bd7644 Mon Sep 17 00:00:00 2001 From: Derek Herman Date: Tue, 15 Aug 2017 18:40:25 -0700 Subject: [PATCH 5/5] Fix coverage clover --- check-diff.sh | 2 +- travis.after_script.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/check-diff.sh b/check-diff.sh index f8e769c..50f16cc 100755 --- a/check-diff.sh +++ b/check-diff.sh @@ -736,7 +736,7 @@ function run_phpunit_travisci { INITIAL_DIR=$(pwd) if [ -n "$PHPUNIT_CONFIG" ]; then - phpunit $( if [ -n "$PHPUNIT_CONFIG" ]; then echo -c "$PHPUNIT_CONFIG"; fi ) + phpunit $( if [ -n "$PHPUNIT_CONFIG" ]; then echo -c "$PHPUNIT_CONFIG"; fi ) $(coverage_clover) else for project in $( find_phpunit_dirs ); do ( diff --git a/travis.after_script.sh b/travis.after_script.sh index 40cfbd0..3bd2eca 100755 --- a/travis.after_script.sh +++ b/travis.after_script.sh @@ -3,8 +3,8 @@ set -e set -v -if can_generate_coverage_clover && [ -s "$TEMP_DIRECTORY/paths-scope-php" ] && [ -n "$PHPUNIT_COVERAGE_DIR" ]; then - cd "$PHPUNIT_COVERAGE_DIR" +if can_generate_coverage_clover && [ -s "$TEMP_DIRECTORY/paths-scope-php" ] && [ -n "$INITIAL_DIR" ]; then + cd "$INITIAL_DIR" php vendor/bin/coveralls -vvv cd - > /dev/null fi