Skip to content
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #26 from liquidweb/feature/use-woocommerce-test-tools
Browse files Browse the repository at this point in the history
Leverage the WooCommerce test framework
  • Loading branch information
bswatson authored Jan 12, 2018
2 parents 3751e79 + 9ac856f commit 77e4e2b
Show file tree
Hide file tree
Showing 19 changed files with 1,190 additions and 941 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/tests/coverage
/vendor
composer.lock
tests/coverage
vendor
55 changes: 20 additions & 35 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
language: php
sudo: false
dist: trusty

language: php

notifications:
email: false

Expand All @@ -11,48 +10,34 @@ cache:
- $HOME/.composer/cache

matrix:
fast_finish: true
include:
- php: 7.2
env: WP_VERSION=trunk
env: WP_VERSION=trunk WP_MULTISITE=0 RUN_PHPCS=1
- php: 7.2
env: WP_VERSION=trunk WP_MULTISITE=1
- php: 7.1
env: WP_VERSION=latest
env: WP_VERSION=latest WP_MULTISITE=0
- php: 7.0
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=latest
#- php: 5.6
# env: WP_TRAVISCI=phpcs
- php: 5.3
env: WP_VERSION=latest
dist: precise
env: WP_VERSION=latest WP_MULTISITE=0

# The following WooCommerce core test currently fails in multisite, with or without this
# plugin being active:
#
# WC_Tests_Setup_Functions::test_wizard_in_cart_payment_gateways()
allow_failures:
- php: 7.2
env: WP_VERSION=trunk WP_MULTISITE=1


before_script:
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- |
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
- |
if [[ ! -z "$WP_VERSION" ]] ; then
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
composer global require "phpunit/phpunit=4.8.*|5.7.*"
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
- bash tests/bin/install-wp-tests.sh woocommerce_test root '' localhost $WP_VERSION
- composer install --prefer-source

script:
- phpunit
- |
if [[ ! -z "$WP_VERSION" ]] ; then
phpunit
WP_MULTISITE=1 phpunit
fi
- |
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
phpcs
if [[ ${RUN_PHPCS} == 1 ]]; then
./vendor/bin/phpcs
fi
25 changes: 22 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,23 @@
"composer/installers": "^1.4",
"xrstf/composer-php52": "^1.0"
},
"require-dev": {
"php": "^7.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
"wimg/php-compatibility": "^8.1",
"woocommerce/woocommerce": "dev-master",
"woocommerce/woocommerce-sniffs": "^0.0.1",
"wp-coding-standards/wpcs": "^0.14"
},
"autoload": {
"classmap": ["includes"]
"classmap": [
"includes"
]
},
"autoload-dev": {
"classmap": ["tests/test-tools"]
"classmap": [
"vendor/woocommerce/woocommerce/tests/framework"
]
},
"scripts": {
"post-install-cmd": [
Expand All @@ -25,7 +37,14 @@
"xrstf\\Composer52\\Generator::onPostInstallCmd"
],
"test-coverage": [
"phpunit --coverage-html=tests/coverage"
"phpunit --testsuite=plugin --coverage-html=tests/coverage"
]
},
"extra": {
"installer-paths": {
"vendor/{$vendor}/{$name}": [
"woocommerce/woocommerce"
]
}
}
}
Loading

0 comments on commit 77e4e2b

Please sign in to comment.