Skip to content

holyhope/test-wordpress-plugin-github-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

branding<icon:check-circle color:blue> GitHub Action: WordPress Plugin Integration Test

ReleaseReleaseCommitOpen IssuesDownloads

Test a WordPress plugin using PHPUnit.

This action tests a WordPress plugin in a environment that is similar to a real WordPress site. It installs WordPress, activates the plugin, and runs the tests. Read more about the WordPress plugin integration test.

The action installs the specified PHP version and extensions, installs WordPress, installs development dependencies, and runs PHPUnit tests.

WordPress plugin integration tests usually require PHPUnit-Polyfills to run, so you probably want to specify the version of PHPUnit-Polyfills to install in your composer.json file.

Usage

- uses: holyhope/test-wordpress-plugin-github-action@main
  with:
    # Description: WordPress version
    #
    # Default: latest
    wordpress_version: ""

    # Description: PHP version
    #
    # Default: 8.2
    php_version: ""

    # Description: PHP extensions to install. Each extension should be on a new line.
    #
    # Default: imagick
    php_extensions: ""

    # Description: Path to the WordPress plugin
    #
    # Default: .
    plugin_dir: ""

    # Description: Slug of the WordPress plugin
    #
    plugin_slug: ""

    # Description: PHPUnit version to install.
    #
    # Set to `false` to use the system-wide PHPUnit binary.
    #
    # Default: Install the version found in `composer.json` file or `^9` if not found.
    #
    # Default: ^9
    phpunit_version: ""

    # Description: PHPUnit configuration file
    #
    # Default: phpunit.xml
    phpunit_config: ""

    # Description: Generates files needed for running PHPUnit tests in a plugin.
    #
    # Default: true
    scaffold_tests: ""

Inputs

Input Description Default Required
wordpress_version WordPress version latest false
php_version PHP version 8.2 false
php_extensions PHP extensions to install.
Each extension should be on a new line.
imagick false
plugin_dir Path to the WordPress plugin . false
plugin_slug Slug of the WordPress plugin true
phpunit_version PHPUnit version to install. ^9 false
phpunit_config PHPUnit configuration file phpunit.xml false
scaffold_tests Generates files needed for running PHPUnit tests in a plugin. true false
Output Description
junit_report Path to the JUnit report

About

Github action to test a WordPress plugin

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors