Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshcanhelp/wp-test-plugin
WordPress plugin to describe a running test test suite
https://github.com/joshcanhelp/wp-test-plugin
Last synced: 24 days ago
JSON representation
WordPress plugin to describe a running test test suite
- Host: GitHub
- URL: https://github.com/joshcanhelp/wp-test-plugin
- Owner: joshcanhelp
- License: gpl-3.0
- Created: 2020-08-29T17:55:51.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-11T22:23:25.000Z (about 4 years ago)
- Last Synced: 2024-12-18T01:47:32.885Z (25 days ago)
- Language: PHP
- Size: 54.7 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WordPress Test Plugin
This is an installable sample plugin for showing running tests in a WordPress environment. See [the introduction post](https://www.joshcanhelp.com/wordpress-unit-testing-wordpress-unit-testing-tactics/) for more details about how this is used.
## Getting Started
The purpose of this plugin is to show example tests against functional code. I used the [WP-CLI unit test helper](https://make.wordpress.org/cli/handbook/misc/plugin-unit-tests/) to generate what I needed and made changes from there.
In order to run tests, you'll need a locally running database server (I used Brew for this following [this guide](https://getgrav.org/blog/macos-catalina-apache-mysql-vhost-apc)). Using WP-CLI link above, look for the command `bin/install-wp-tests.sh` and follow the instructions to get the environment up and running. I **always** have issues getting this running from the start so give yourself some time (and grace) if it's your first time through the process!
Once that's working, the rest is Composer:
```bash
$ composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Installing lots of stuff ...$ composer test
> "vendor/bin/phpunit"....................... 23 / 23 (100%)
Time: 1.02 seconds, Memory: 28.00 MB
OK (23 tests, 74 assertions)
```