wp_mock
wp_mock copied to clipboard
WordPress API Mocking Framework
## Feature request WP_Mock is not compatible with PHPUnit 10 / PHP 8.1. ### Proposed solution Make it compatible. Maybe You have it already in plans?
## Feature request At the moment we can currently pass a Closure as the return value when mocking functions using the ```\WP_Mock::userFunction``` like so: ``` WP_Mock::userFunction( 'get_post_meta', [ 'times' =>...
This will make it easy for people to setup `wp_mock` for plugins and will also reduce the barrier to entry.
**Describe the bug** In Distributor, I am attempting to mock a function to return an empty array: https://github.com/10up/distributor/blob/74ba9c5110de1dfa3415e76eab7d7ffc87b19e49/tests/php/SubscriptionsTest.php#L321-L325 However, the return value is coming back as `NULL`. As an alternative...
I know that wp_mock and WordPress core Unit tests work differently and it may not even be possible to have them run together. I use both and like both. But...
**Is your feature request related to a problem? Please describe.** If I have a pre-defined array as my first filter argument in some method, there's no easy way to write...
WP_Mock provides useful helpers for `expectFilterAdded` and `expectFilterNotAdded`, and heir companion for actions. However, we have no canonical way of checking `remove_action` nor `remove_filter` calls. It would be fantastic to...
# Summary As said in #157: > WP_Mock provides useful helpers for `expectFilterAdded` and `expectFilterNotAdded`, and [their] companion actions. However, we have no canonical way of checking `remove_action` nor `remove_filter`...
## Feature request Currently, in my `bootstrap.php` I typically use `WP_Mock::activateStrictMode()`. I would like to disable strict mode for some tests, in particular where I use `WP_Mock::expectActionAdded()`. Often, a function...
## Bug report - Need update of dependent libraries to support php 8.2+ ### Replication steps - If we run phpcs on the repo we see the following errors ![Screenshot...