Skip to content

Merge pull request #376 from anktd/fix-headers-already-sent-error #19

Merge pull request #376 from anktd/fix-headers-already-sent-error

Merge pull request #376 from anktd/fix-headers-already-sent-error #19

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: '8.1' # Ensuring PHP 8.1 is used
extensions: mbstring, xml, curl, pdo_mysql
coverage: pcov
tools: composer:v2
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- 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 "CREATE USER 'wp'@'localhost' IDENTIFIED BY 'wp';" -uroot -proot
mysql -e "GRANT ALL PRIVILEGES ON wordpress_tests.* TO 'wp'@'localhost';" -uroot -proot
mysql -e 'FLUSH PRIVILEGES;' -uroot -proot
- name: Run PHPUnit tests
run: vendor/bin/phpunit tests/