Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/joshcanhelp/wp-unit-test-helpers

A set of traits to help you write unit tests for WP plugins and themes
https://github.com/joshcanhelp/wp-unit-test-helpers

Last synced: 24 days ago
JSON representation

A set of traits to help you write unit tests for WP plugins and themes

Awesome Lists containing this project

README

        

# WP Unit Test Helpers

[![Latest Stable Version](https://poser.pugx.org/joshcanhelp/wp-unit-test-helpers/v/stable)](https://packagist.org/packages/joshcanhelp/wp-unit-test-helpers)
[![License](https://poser.pugx.org/joshcanhelp/wp-unit-test-helpers/license)](https://packagist.org/packages/joshcanhelp/wp-unit-test-helpers)
[![Total Downloads](https://poser.pugx.org/joshcanhelp/wp-unit-test-helpers/downloads)](https://packagist.org/packages/joshcanhelp/wp-unit-test-helpers)

See [the introduction post](https://www.joshcanhelp.com/wordpress-unit-testing-techniques/) for more details about how this is used.

Examples of these traits in use:

- [HTTP request inspection](https://github.com/joshcanhelp/wp-test-plugin/blob/master/tests/testHttpHaltWpTestCase.php)
- [HTTP response handling](https://github.com/joshcanhelp/wp-test-plugin/blob/master/tests/testHttpMockWpTestCase.php)
- [Redirect inspection](https://github.com/joshcanhelp/wp-test-plugin/blob/master/tests/testRedirectHaltWpTestCase.php)
- [Killed processes with wp_die()](https://github.com/joshcanhelp/wp-test-plugin/blob/master/tests/testWpDieHandlingWpTestCase.php)
- [AJAX Requests](https://github.com/joshcanhelp/wp-test-plugin/blob/master/tests/testAjaxHandlingWpTestCase.php)
- [Hooked Functions](https://github.com/joshcanhelp/wp-test-plugin/blob/master/tests/testHookedFunctionsWpTestCase.php)
- [Enqueued Styles and Scripts](https://github.com/joshcanhelp/wp-test-plugin/blob/master/tests/testEnqueuedStyleWpTestCase.php)