Skip to content

Add Initial Unit Tests and Update Composer Dependencies #2

Add Initial Unit Tests and Update Composer Dependencies

Add Initial Unit Tests and Update Composer Dependencies #2

Workflow file for this run

name: Run PHPUnit Tests
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: wordpress_tests
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=10s
--health-retries=10
steps:
- uses: actions/checkout@v2
- name: Setup PHP, with Composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, xml, curl, pdo_mysql
coverage: pcov
tools: composer:v2
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Start MySQL
run: sudo /etc/init.d/mysql start
- name: Prepare WordPress Database
run: |
mysql -e 'CREATE DATABASE wordpress_tests;' -uroot -proot
mysql -e "GRANT ALL PRIVILEGES ON wordpress_tests.* TO 'wp'@'localhost' IDENTIFIED BY 'wp';" -uroot -proot
mysql -e 'FLUSH PRIVILEGES;' -uroot -proot
- name: Run PHPUnit tests
run: vendor/bin/phpunit
- name: Check coding standards
run: ./vendor/bin/phpcs