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

Commit 77e4e2b

Browse files
authored
Merge pull request #26 from liquidweb/feature/use-woocommerce-test-tools
Leverage the WooCommerce test framework
2 parents 3751e79 + 9ac856f commit 77e4e2b

19 files changed

+1190
-941
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
/tests/coverage
2-
/vendor
3-
composer.lock
1+
tests/coverage
2+
vendor

.travis.yml

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
language: php
12
sudo: false
23
dist: trusty
34

4-
language: php
5-
65
notifications:
76
email: false
87

@@ -11,48 +10,34 @@ cache:
1110
- $HOME/.composer/cache
1211

1312
matrix:
13+
fast_finish: true
1414
include:
1515
- php: 7.2
16-
env: WP_VERSION=trunk
16+
env: WP_VERSION=trunk WP_MULTISITE=0 RUN_PHPCS=1
17+
- php: 7.2
18+
env: WP_VERSION=trunk WP_MULTISITE=1
1719
- php: 7.1
18-
env: WP_VERSION=latest
20+
env: WP_VERSION=latest WP_MULTISITE=0
1921
- php: 7.0
20-
env: WP_VERSION=latest
21-
- php: 5.6
22-
env: WP_VERSION=latest
23-
#- php: 5.6
24-
# env: WP_TRAVISCI=phpcs
25-
- php: 5.3
26-
env: WP_VERSION=latest
27-
dist: precise
22+
env: WP_VERSION=latest WP_MULTISITE=0
23+
24+
# The following WooCommerce core test currently fails in multisite, with or without this
25+
# plugin being active:
26+
#
27+
# WC_Tests_Setup_Functions::test_wizard_in_cart_payment_gateways()
28+
allow_failures:
29+
- php: 7.2
30+
env: WP_VERSION=trunk WP_MULTISITE=1
31+
2832

2933
before_script:
3034
- export PATH="$HOME/.composer/vendor/bin:$PATH"
31-
- |
32-
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
33-
phpenv config-rm xdebug.ini
34-
else
35-
echo "xdebug.ini does not exist"
36-
fi
37-
- |
38-
if [[ ! -z "$WP_VERSION" ]] ; then
39-
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
40-
composer global require "phpunit/phpunit=4.8.*|5.7.*"
41-
fi
42-
- |
43-
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
44-
composer global require wp-coding-standards/wpcs
45-
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
46-
fi
35+
- bash tests/bin/install-wp-tests.sh woocommerce_test root '' localhost $WP_VERSION
4736
- composer install --prefer-source
4837

4938
script:
39+
- phpunit
5040
- |
51-
if [[ ! -z "$WP_VERSION" ]] ; then
52-
phpunit
53-
WP_MULTISITE=1 phpunit
54-
fi
55-
- |
56-
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
57-
phpcs
41+
if [[ ${RUN_PHPCS} == 1 ]]; then
42+
./vendor/bin/phpcs
5843
fi

composer.json

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,23 @@
88
"composer/installers": "^1.4",
99
"xrstf/composer-php52": "^1.0"
1010
},
11+
"require-dev": {
12+
"php": "^7.0",
13+
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
14+
"wimg/php-compatibility": "^8.1",
15+
"woocommerce/woocommerce": "dev-master",
16+
"woocommerce/woocommerce-sniffs": "^0.0.1",
17+
"wp-coding-standards/wpcs": "^0.14"
18+
},
1119
"autoload": {
12-
"classmap": ["includes"]
20+
"classmap": [
21+
"includes"
22+
]
1323
},
1424
"autoload-dev": {
15-
"classmap": ["tests/test-tools"]
25+
"classmap": [
26+
"vendor/woocommerce/woocommerce/tests/framework"
27+
]
1628
},
1729
"scripts": {
1830
"post-install-cmd": [
@@ -25,7 +37,14 @@
2537
"xrstf\\Composer52\\Generator::onPostInstallCmd"
2638
],
2739
"test-coverage": [
28-
"phpunit --coverage-html=tests/coverage"
40+
"phpunit --testsuite=plugin --coverage-html=tests/coverage"
2941
]
42+
},
43+
"extra": {
44+
"installer-paths": {
45+
"vendor/{$vendor}/{$name}": [
46+
"woocommerce/woocommerce"
47+
]
48+
}
3049
}
3150
}

0 commit comments

Comments
 (0)