Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPUnit Test Setup #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/*.min.js
vendor
lib
wordpress
51 changes: 51 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: PHPUnit

on: pull_request

jobs:
phpunit:
name: PHPUnit (PHP ${{ matrix.php }} with WordPress ${{ matrix.wordpress }})
runs-on: ubuntu-latest

env:
WP_DB_HOST: 127.0.0.1
WP_DB_NAME: local
WP_DB_USER: root
WP_DB_PASS: ""

services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: local
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

strategy:
fail-fast: false
matrix:
php: ['7.4']
wordpress: ['trunk']

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: composer, cs2pr

- name: Composer Install
uses: ramsey/composer-install@v1

- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Run tests
run: composer run test
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ node_modules/
*.sql
*.tar.gz
*.zip
vendor/
vendor/

# phpunit
.phpunit.result.cache
wordpress/
14 changes: 10 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@
"description": "Easier way to edit all meta options through Bulk Edit or Quick Edit.",
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"wp-coding-standards/wpcs": "dev-master",
"phpcompatibility/phpcompatibility-wp": "*"
"wp-coding-standards/wpcs": "^2.2",
"phpcompatibility/phpcompatibility-wp": "*",
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5",
"wp-phpunit/wp-phpunit": "^6.0",
"yoast/phpunit-polyfills": "^1.0",
"roots/wordpress": "^6.0"
},
"scripts": {
"format": "phpcbf --standard=phpcs.xml.dist --report-summary --report-source",
"lint": "phpcs --standard=phpcs.xml.dist --report-summary --report-source"
"lint": "phpcs --standard=phpcs.xml.dist --report-summary --report-source",
"test": "vendor/bin/phpunit"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"roots/wordpress-core-installer": true
}
}
}
Loading
Loading