Skip to content

Commit

Permalink
Update libraries, coding standards, tests and Travis config.
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed Feb 9, 2019
1 parent a720554 commit ffa8b82
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 105 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,5 @@
# Node.js
/node_modules/

# WordPress content
/wp-content/

# WordPress
/wordpress/
88 changes: 64 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,44 @@ sudo: false

language: php

php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- nightly
- hhvm
env:
global:
- COMPOSER_NO_INTERACTION=1
- WP_VERSION=*

matrix:
jobs:
include:
- php: 7.2
env: WP_VERSION=5.0 COVERAGE=1 PHPCS=1
- php: 7.2
env: WP_VERSION=4.9
- php: 7.2
env: WP_VERSION=4.8
- php: 7.2
env: WP_VERSION=4.7
- php: 7.2
env: WP_MULTISITE=1
- php: 7.2
env: PHPSTAN=1
- php: 7.2
env: PHPMD=1
- php: 7.2
env: PSALM=1
- php: 7.1
- php: 7.0
- php: 5.6
- php: 5.5
- php: 5.4
- php: 5.3
dist: precise
env: TRAVIS_DIST_PRECISE=1
- php: 5.6
env: WP_MULTISITE=1
- php: 5.6
env: WP_VERSION=4.8
- php: 5.6
env: WP_VERSION=4.7 COVERAGE=1 GRUNT=1
fast_finish: true
- php: nightly
- php: hhvm
allow_failures:
- php: hhvm
- php: nightly
- env: PHPMD=1
- env: PSALM=1

cache:
directories:
Expand All @@ -41,6 +54,23 @@ before_install:
- if [ "${TRAVIS_DIST_PRECISE}" == "1" ]; then nvm install node; fi
# Create database for PHPUnit tests.
- mysql -e 'CREATE DATABASE wp_phpunit_tests;'
# Remove Xdebug for a huge performance increase:
- |
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
phpenv config-rm xdebug.ini
else
echo "xdebug.ini does not exist"
fi
# Raise PHP memory limit to 2048MB
- echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
# Validate composer.json file.
- composer validate --strict
# Add Composer global vendor/bin to path.
- export PATH="$HOME/.composer/vendor/bin:$PATH"
# PHPStan
- if [ "$PHPSTAN" == "1" ]; then composer global require phpstan/phpstan; fi
# Psalm
- if [ "$PSALM" == "1" ]; then composer global require vimeo/psalm; fi

install:
# Install Grunt command line interface (https://github.com/gruntjs/grunt-cli).
Expand All @@ -52,14 +82,24 @@ install:
# Install Composer packages.
- composer install
# Test on specific WordPress version.
- if [ "$WP_VERSION" ]; then composer require wp-phpunit/wp-phpunit:$WP_VERSION --dev; fi
- if [ "$WP_VERSION" ]; then composer require roots/wordpress:$WP_VERSION --dev --update-with-dependencies; fi
- composer require --dev --update-with-dependencies roots/wordpress:${WP_VERSION} wp-phpunit/wp-phpunit:${WP_VERSION}
# List available packages.
- composer show

script:
- if [[ -z "$GRUNT" ]]; then grunt phpunit; fi
- if [[ -z "$GRUNT" ]]; then grunt phplint; fi
- if [[ "$GRUNT" == "1" ]]; then grunt; fi
# PHPLint
- composer run-script phplint
# PHPUnit
- composer run-script phpunit
# PHP_CodeSniffer
- if [ "$PHPCS" == "1" ]; then composer run-script phpcs; fi
# PHP Mess Detector
- if [ "$PHPMD" == "1" ]; then composer run-script phpmd; fi
# PHPStan
- if [ "$PHPSTAN" == "1" ]; then phpstan analyze; fi
# Psalm
- if [ "$PSALM" == "1" ]; then psalm; fi

after_success:
- if [ $COVERAGE == "1" ]; then php vendor/bin/coveralls -v; fi
- if [ $COVERAGE == "1" ]; then bash <(curl -s https://codecov.io/bash); fi
- if [ "$COVERAGE" == "1" ]; then composer run-script coveralls; fi
- if [ "$COVERAGE" == "1" ]; then bash <(curl -s https://codecov.io/bash); fi
21 changes: 14 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,26 @@
"require": {
"php": "^5.3",
"icepay/icepay": "~2.4.0",
"wp-pay/core": "^2.0",
"wp-pay-gateways/common": "^2.0"
"wp-pay/core": "^2.1"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
"php-coveralls/php-coveralls": "^1.0",
"phpcompatibility/php-compatibility": "^9.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.5",
"php-coveralls/php-coveralls": "^1.1",
"phpcompatibility/php-compatibility": "^9.1",
"phpcompatibility/phpcompatibility-wp": "^2.0",
"phpmd/phpmd": "^2.2.3",
"phpmd/phpmd": "^2.4",
"phpunit/phpunit": "^4.8",
"roots/wordpress": "^5.0",
"squizlabs/php_codesniffer": "^2.7",
"squizlabs/php_codesniffer": "^2.9",
"wp-coding-standards/wpcs": "^1.2",
"wp-phpunit/wp-phpunit": "^5.0"
},
"scripts": {
"coveralls": "vendor/bin/coveralls -v",
"phpcbf": "vendor/bin/phpcbf",
"phpcs": "vendor/bin/phpcs -s -v",
"phplint": "ls src/**/*.php tests/**/*.php | xargs -n 1 -P 4 php -l",
"phpmd": "vendor/bin/phpmd src,tests text phpmd.ruleset.xml --suffixes php",
"phpunit": "vendor/bin/phpunit"
}
}
66 changes: 2 additions & 64 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
<arg value="sp" />

<exclude-pattern>node_modules/*</exclude-pattern>
<exclude-pattern>tests/bootstrap.php</exclude-pattern>
<exclude-pattern>tests/wp-config.php</exclude-pattern>
<exclude-pattern>vendor/*</exclude-pattern>
<exclude-pattern>wordpress/*</exclude-pattern>
<exclude-pattern type="relative">^/wp-content/*</exclude-pattern>

<rule ref="PHPCompatibilityWP" />

Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<filter>
<whitelist>
<directory>src</directory>
<directory suffix=".php">src</directory>
</whitelist>
</filter>

Expand Down
7 changes: 1 addition & 6 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
* @package Pronamic\WordPress\Pay\Gateways\Icepay
*/

/**
* Autoload.
*/
require_once __DIR__ . '/../vendor/autoload.php';

require_once getenv( 'WP_PHPUNIT__DIR' ) . '/includes/functions.php';
Expand All @@ -26,7 +23,5 @@ function _manually_load_plugin() {

tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );

/**
* Bootstrap.
*/
// Bootstrap.
require getenv( 'WP_PHPUNIT__DIR' ) . '/includes/bootstrap.php';

0 comments on commit ffa8b82

Please sign in to comment.