Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 33 additions & 29 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: PHPUnit Tests

env:
COMPOSER_VERSION: "2"
Expand All @@ -16,7 +16,6 @@ on:
- develop

jobs:

phpunit:
name: ${{ matrix.php }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -27,30 +26,35 @@ jobs:
os: [ ubuntu-latest ]

steps:
- name: Checkout
uses: actions/checkout@v2.4.0

- name: Set standard 10up cache directories
run: |
composer config -g cache-dir "${{ env.COMPOSER_CACHE }}"

- name: Prepare composer cache
uses: actions/cache@v2
with:
path: ${{ env.COMPOSER_CACHE }}
key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-${{ env.COMPOSER_VERSION }}-

- name: Set PHP version
uses: shivammathur/setup-php@2.17.0
with:
php-version: ${{ matrix.php }}
coverage: none
tools: phpunit-polyfills, composer:v2

- name: Install dependencies
run: composer update -W

- name: PHPUnit
run: './vendor/bin/phpunit'
- name: Checkout
uses: actions/checkout@v2.4.0

- name: Set standard 10up cache directories
run: |
composer config -g cache-dir "${{ env.COMPOSER_CACHE }}"

- name: Prepare composer cache
uses: actions/cache@v2
with:
path: ${{ env.COMPOSER_CACHE }}
key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-${{ env.COMPOSER_VERSION }}-

- uses: getong/mariadb-action@v1.1

- name: Set PHP version
uses: shivammathur/setup-php@2.17.0
with:
php-version: ${{ matrix.php }}
coverage: none
tools: phpunit-polyfills, composer:v2

- name: Install dependencies
run: composer update -W

- name: Setup WP Tests
run: bash tests/bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1

- name: PHPUnit
run: composer run test
15 changes: 11 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@
"Distributor\\": "includes/classes/"
}
},
"autoload-dev": {
"psr-4": {
"Distributor\\Tests\\": "tests/php/"
}
},
"require-dev": {
"10up/phpcs-composer": "dev-master",
"10up/wp_mock": "~0.4",
"phpunit/phpunit": ">=7.0 <9.0",
"yoast/phpunit-polyfills": "^1.0",
"automattic/vipwpcs": "^2.3"
"automattic/vipwpcs": "^2.3",
"php-stubs/wordpress-tests-stubs": "^6.3",
"yoast/phpunit-polyfills": "dev-main"
},
"scripts": {
"lint": "@php phpcs . --runtime-set testVersion 7.4-",
Expand All @@ -38,6 +42,9 @@
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
},
"platform": {
"php": "7.4"
}
}
}
Loading