Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devkabir/wordpress-plugin-phpunit-starter
This repository provides a starter kit for unit testing WordPress plugins using PHPUnit.
https://github.com/devkabir/wordpress-plugin-phpunit-starter
phpunit starter wordpress
Last synced: 6 days ago
JSON representation
This repository provides a starter kit for unit testing WordPress plugins using PHPUnit.
- Host: GitHub
- URL: https://github.com/devkabir/wordpress-plugin-phpunit-starter
- Owner: devkabir
- Created: 2023-12-17T06:08:17.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-06-18T08:58:28.000Z (5 months ago)
- Last Synced: 2024-10-10T11:43:41.364Z (27 days ago)
- Topics: phpunit, starter, wordpress
- Language: PHP
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PHPUnit Starter for WordPress Plugin
This repository provides a starter kit for unit testing WordPress plugins using PHPUnit.
## Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
## 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
1. Clone the repository
```sh
git clone https://github.com/devkabir/phpunit-starter-for-wordpress-plugin.git
```
2. Install Composer dependencies```sh
composer install
```3. Navigate to the plugin directory
```sh
cd phpunit-starter-for-wordpress-plugin
```3. 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.
4. Run the tests
```sh
composer test
```