Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.

Commit

Permalink
Added tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Jan 3, 2016
1 parent a1efc2a commit ad0e000
Show file tree
Hide file tree
Showing 18 changed files with 1,249 additions and 105 deletions.
38 changes: 38 additions & 0 deletions .travis.yml
@@ -0,0 +1,38 @@
sudo: false

language: php

matrix:
include:
- php: 5.2
env: WP_VERSION=latest WP_MULTISITE=1
- php: 5.2
env: WP_VERSION=4.0 WP_MULTISITE=1
- php: 5.3
env: WP_VERSION=4.0
- php: 5.4
env: WP_VERSION=4.0
- php: 5.5
env: WP_VERSION=4.0
- php: 5.6
env: WP_VERSION=4.0 COVERAGE=1 GRUNT=1
- php: 7.0
env: WP_VERSION=4.0
- php: hhvm
env: WP_VERSION=4.0
fast_finish: true

cache:
directories:
- node_modules
- vendor
- $HOME/.composer/cache

before_script:
- bash bin/travis-before_script

script:
- bash bin/travis-script

after_success:
- bash bin/travis-after_success
61 changes: 61 additions & 0 deletions Gruntfile.js
@@ -0,0 +1,61 @@
module.exports = function( grunt ) {
require( 'load-grunt-tasks' )( grunt );

// Project configuration.
grunt.initConfig( {
// Package
pkg: grunt.file.readJSON( 'package.json' ),

// JSHint
jshint: {
all: [ 'Gruntfile.js', 'composer.json', 'package.json' ]
},

// PHP Code Sniffer
phpcs: {
application: {
src: [
'**/*.php',
'!node_modules/**',
'!vendor/**'
]
},
options: {
bin: 'vendor/bin/phpcs',
standard: 'phpcs.ruleset.xml',
showSniffCodes: true
}
},

// PHPLint
phplint: {
options: {
phpArgs: {
'-lf': null
}
},
all: [ 'src/**/*.php' ]
},

// PHP Mess Detector
phpmd: {
application: {
dir: 'src'
},
options: {
bin: 'vendor/bin/phpmd',
exclude: 'node_modules',
reportFormat: 'xml',
rulesets: 'phpmd.ruleset.xml'
}
},

// PHPUnit
phpunit: {
application: {},
},
} );

// Default task(s).
grunt.registerTask( 'default', [ 'jshint', 'phplint', 'phpmd', 'phpcs', 'phpunit' ] );
};
6 changes: 6 additions & 0 deletions bin/install-wpcs
@@ -0,0 +1,6 @@
#!/bin/bash

# WordPress Coding Standards
if [[ -d vendor/wp-coding-standards/wpcs ]]; then
vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs
fi
6 changes: 6 additions & 0 deletions bin/travis-after_success
@@ -0,0 +1,6 @@
#!/bin/bash

# Coveralls
if [[ '1' == $COVERAGE ]]; then
php vendor/bin/coveralls
fi
21 changes: 21 additions & 0 deletions bin/travis-before_script
@@ -0,0 +1,21 @@
#!/bin/bash

set -ev

phpenv local 5.6

composer self-update

if [[ '1' == $COVERAGE ]]; then
composer install
else
composer install --no-dev
fi

phpenv local --unset

phpenv rehash

wget https://raw.githubusercontent.com/wp-cli/sample-plugin/master/bin/install-wp-tests.sh

bash install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
15 changes: 15 additions & 0 deletions bin/travis-script
@@ -0,0 +1,15 @@
#!/bin/bash

set -ev

# PHPUnit
phpunit

# Grunt
if [[ '1' == $GRUNT ]]; then
npm install -g grunt-cli

npm install --no-optional

grunt
fi
19 changes: 18 additions & 1 deletion composer.json
Expand Up @@ -28,13 +28,30 @@
},
"require": {
"php": ">=5.2.4",
"xrstf/composer-php52": "1.*",
"wp-pay/core": "dev-develop",
"wp-pay-gateways/common": "dev-develop",
"wp-pay-gateways/ideal": "dev-develop",
"wp-pay-gateways/ideal-advanced": "dev-develop",
"wp-pay-gateways/ideal-advanced-v3": "dev-develop"
},
"require-dev": {
"satooshi/php-coveralls": "dev-master"
"phpmd/phpmd": "^2.2.3",
"satooshi/php-coveralls": "^0.7.1",
"squizlabs/php_codesniffer": "^2.2.0",
"wp-coding-standards/wpcs": "0.8.0",
"wp-cli/wp-cli": "^0.21.1"
},
"scripts": {
"post-install-cmd": [
"xrstf\\Composer52\\Generator::onPostInstallCmd"
],
"post-update-cmd": [
"xrstf\\Composer52\\Generator::onPostInstallCmd"
],
"post-autoload-dump": [
"xrstf\\Composer52\\Generator::onPostInstallCmd",
"bin/install-wpcs"
]
}
}

0 comments on commit ad0e000

Please sign in to comment.