Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wp-phpunit/example-plugin
A complete example for using WP PHPUnit in the context of plugin development.
https://github.com/wp-phpunit/example-plugin
phpunit wordpress wordpress-development wordpress-plugin wordpress-tests wp-phpunit
Last synced: 9 days ago
JSON representation
A complete example for using WP PHPUnit in the context of plugin development.
- Host: GitHub
- URL: https://github.com/wp-phpunit/example-plugin
- Owner: wp-phpunit
- Created: 2017-12-10T12:53:50.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-09-06T23:06:14.000Z (about 2 years ago)
- Last Synced: 2023-02-28T07:26:16.531Z (over 1 year ago)
- Topics: phpunit, wordpress, wordpress-development, wordpress-plugin, wordpress-tests, wp-phpunit
- Language: PHP
- Homepage:
- Size: 43.9 KB
- Stars: 10
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Example Plugin
[![Build Status](https://app.travis-ci.com/wp-phpunit/example-plugin.svg?branch=master)](https://app.travis-ci.com/wp-phpunit/example-plugin)
A complete example for using WP PHPUnit in the context of plugin development.
## Features
**Travis CI Configuration**
A ready to use `.travis.yml` configured with a reasonable test matrix
- Includes all currently supported versions of PHP (7.4 and 8.0) and the current WP minimum required PHP 5.6
- Tests against the latest version of WordPress, as well as an older version (4.9) although it could be easily extended to include multiple older versions, multisite, etc.**Just Add Tests**
This project includes a working example `test-example.php` test case. Adding tests is as simple as adding methods to this example class! Getting up and running couldn't be easier.
## Local Development
Install Composer dependencies
```sh
$ composer install
```Create a database for your tests to use and update your `tests/wp-config.php` as necessary.
```sh
$ mysqladmin create wp_phpunit_tests -u root
```The database name defaults to `wp_phpunit_tests`, but you can change this in the `tests/wp-config.php` without affecting the Travis configuration which is environment variable-based.
Run the tests
```sh
$ composer test
```