Commit 01c7c55c authored by Erick Hitter's avatar Erick Hitter
Browse files

Add PHPCS support to Travis

parent 77c2e840
sudo: false
language: php language: php
notifications: notifications:
...@@ -5,25 +7,51 @@ notifications: ...@@ -5,25 +7,51 @@ notifications:
on_success: never on_success: never
on_failure: change on_failure: change
php: cache:
- 5.6 directories:
- 7.0 - vendor
- $HOME/.composer/cache
env: matrix:
- WP_VERSION=latest WP_MULTISITE=0 include:
- WP_VERSION=latest WP_MULTISITE=1 - php: 7.1
- WP_VERSION=trunk WP_MULTISITE=0 env: WP_VERSION=latest
- WP_VERSION=trunk WP_MULTISITE=1 - php: 7.0
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=4.4
- php: 5.6
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=trunk
- php: 5.6
env: WP_TRAVISCI=phpcs
before_script: before_script:
- phpenv config-rm xdebug.ini - phpenv config-rm xdebug.ini
- export PATH="$HOME/.composer/vendor/bin:$PATH" - export PATH="$HOME/.composer/vendor/bin:$PATH"
- | - |
if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then if [[ ! -z "$WP_VERSION" ]] ; then
composer global require "phpunit/phpunit=5.7.*" bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
elif [[ ${TRAVIS_PHP_VERSION:0:3} != "5.2" ]]; then if [[ ${TRAVIS_PHP_VERSION:0:2} == "5." ]]; then
composer global require "phpunit/phpunit=4.8.*" composer global require "phpunit/phpunit=4.8.*"
else
composer global require "phpunit/phpunit=5.7.*"
fi
fi
- |
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
composer global require wp-coding-standards/wpcs
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
fi fi
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
script: phpunit script:
- |
if [[ ! -z "$WP_VERSION" ]] ; then
phpunit
WP_MULTISITE=1 phpunit
fi
- |
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
phpcs
fi
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards for Plugins">
<description>Generally-applicable sniffs for WordPress plugins</description>
<rule ref="WordPress-Core" />
<rule ref="WordPress-Docs" />
<!-- Check all PHP files in directory tree by default. -->
<arg name="extensions" value="php"/>
<file>.</file>
<!-- Show sniff codes in all reports -->
<arg value="s"/>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
</ruleset>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment