Skip to content

Commit

Permalink
Merge pull request #54 from tollmanz/feature/phpcompatibility-and-cod…
Browse files Browse the repository at this point in the history
…estyle

Minor automated testing tweaks.
  • Loading branch information
jrfnl committed Aug 26, 2016
2 parents 02d327c + ba483cc commit 35c1cdb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
16 changes: 10 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ matrix:
env: SNIFF=1
# aliased to a recent 5.6.x version
- php: '5.6'
# aliased to a recent 7.x version
# aliased to a recent 7.0.x version
- php: '7.0'
# aliased to a recent 7.1.x version
- php: '7.1'
# aliased to a recent hhvm version
- php: 'hhvm'

Expand All @@ -34,14 +36,16 @@ matrix:

before_script:
- export PHPCS_DIR=/tmp/phpcs
- export WPCS_DIR=/tmp/wpcs
- export SNIFFS_DIR=/tmp/sniffs
# Install CodeSniffer for WordPress Coding Standards checks.
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR; fi
# Install WordPress Coding Standards.
- if [[ "$SNIFF" == "1" ]]; then git clone -b develop --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $WPCS_DIR; fi
# Set install path for WordPress Coding Standards.
- if [[ "$SNIFF" == "1" ]]; then git clone -b develop --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $SNIFFS_DIR; fi
# Install PHP Compatibility sniffs.
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/wimg/PHPCompatibility.git $SNIFFS_DIR/PHPCompatibility; fi
# Set install path for PHPCS sniffs.
# @link https://github.com/squizlabs/PHP_CodeSniffer/blob/4237c2fc98cc838730b76ee9cee316f99286a2a7/CodeSniffer.php#L1941
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/scripts/phpcs --config-set installed_paths $WPCS_DIR; fi
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/scripts/phpcs --config-set installed_paths $SNIFFS_DIR; fi
# After CodeSniffer install you should refresh your path.
- if [[ "$SNIFF" == "1" ]]; then phpenv rehash; fi
# Install JSCS: JavaScript Code Style checker
Expand Down Expand Up @@ -71,7 +75,7 @@ script:
# -n flag: Do not print warnings. (shortcut for --warning-severity=0)
# --standard: Use WordPress as the standard.
# --extensions: Only sniff PHP files.
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/scripts/phpcs -p -s -v -n . --standard=./phpcs.xml --extensions=php; fi
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/scripts/phpcs -p -s -n . --standard=./phpcs.xml --extensions=php; fi

# Receive notifications for build results.
# @link http://docs.travis-ci.com/user/notifications/#Email-notifications
Expand Down
1 change: 0 additions & 1 deletion class-debug-bar-cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ class ZT_Debug_Bar_Cron extends Debug_Bar_Panel {
);



/**
* Give the panel a title and set the enqueues.
*
Expand Down
4 changes: 2 additions & 2 deletions debug-bar-cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ function debug_bar_cron_has_parent_plugin() {

// Add to recently active plugins list.
if ( ! is_network_admin() ) {
update_option( 'recently_activated', array( $file => time() ) + (array) get_option( 'recently_activated' ) );
update_option( 'recently_activated', ( array( $file => time() ) + (array) get_option( 'recently_activated' ) ) );
} else {
update_site_option( 'recently_activated', array( $file => time() ) + (array) get_site_option( 'recently_activated' ) );
update_site_option( 'recently_activated', ( array( $file => time() ) + (array) get_site_option( 'recently_activated' ) ) );
}

// Prevent trying again on page reload.
Expand Down
7 changes: 6 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

<exclude-pattern>*/inc/debug-bar-pretty-output/*</exclude-pattern>

<!-- ##### PHP cross-version compatibility ##### -->
<config name="testVersion" value="5.2-99.0"/>
<rule ref="PHPCompatibility"/>


<!-- ##### WordPress sniffs #####-->
<rule ref="WordPress">
<exclude name="WordPress.VIP" />
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" />
</rule>

Expand Down

0 comments on commit 35c1cdb

Please sign in to comment.