10up/wp_mock
A mocking library to take the pain out of unit testing for WordPress
1.1.1
3.3M downloads/mo
#2659 most downloaded on Packagist
10up/wp_mock
What this package is like to depend on
Last release 8 months ago
02 Dec 2025
Release timing varies
gaps range from 2 weeks to 3.6 years
Nearly every release is documented
notes for 12 of 12 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
12 releases · first in 2014
1 release in the last 12 months
see the full history below
Release timeline
12 releases · Dec 2014 to Dec 2025Releases
latest 12-
1.1.102 Dec 2025Release notes
Open source →What's Changed
- Fix: Multiple
onFiltercall issues related to thewithAnyArgsmethod by @badasswp in #259 - Explicitly mark parameter as nullable to address PHP deprecation warning by @agibson-godaddy in #262
- Update CHANGELOG for version 1.1.1 by @wvega-godaddy in #263
Full Changelog: 1.1.0...1.1.1
Release notes
Open source →Fixed
- Address PHP deprecation warnings about implicitly nullable parameters
- Allow
onFilter(...)->withAnyArgs()to be used multiple times on a single tests
- Fix: Multiple
-
1.1.012 Mar 2025Release notes
Open source →What's Changed
- Ignore throws in function mocks by @unfulvio in #245
- Fix typos by @szepeviktor in #250
- Add support for types in
expectFiltermocks by @badasswp in #254 - Fix: GitHub workflows broken due to outdated versions / OS by @agibson-godaddy in #255
- Add support for
withAnyArgsmethod foronFiltercalls. by @badasswp in #256 - Bump symfony/process from 5.4.28 to 5.4.46 in the composer group by @dependabot in #252
- Add changelog for v1.1.0 by @agibson-godaddy in #257
New Contributors
- @unfulvio made their first contribution in #245
- @szepeviktor made their first contribution in #250
- @badasswp made their first contribution in #254
- @agibson-godaddy made their first contribution in #255
Full Changelog: 1.0.1...1.1.0
Release notes
Open source →Added
- Add support for types in
expectFilter()mocks - Add support for
withAnyArgs()method foronFilter()calls
Fixed
- Prevent IDEs/phpstan from detecting exceptions in mocked functions that don't actually throw in WordPress core (e.g.
esc_html()) - Typos in docs and function name (old function
iExcpectWhenIRun()still exists but has been deprecated)
-
1.0.122 Jan 2024Release notes
Open source →What's Changed
- Update
WP_Mock::expectHookNotAdded()with new params by @unfulvio-godaddy in #234 - Update PHP dev dependencies, ensure compatibility with PHP 8.3 environments and run tests with PHP 8.3 by @unfulvio-godaddy in #237
Full Changelog: 1.0.0...1.0.1
Release notes
Open source →Changed
- Updated
WP_Mock::expectHookNotAdded()with new params - Updated PHP dependencies to ensure compatibility with PHP 8.3
- Update
-
1.0.026 Jul 2023Release notes
Open source →What's Changed
- PHP requirement badge should display 7.3+ by @unfulvio-godaddy in #179
- Add PhpStan by @unfulvio-godaddy in #180
- Run tests also in PHP 8.2 by @unfulvio-godaddy in #182
- Add PHPCS (+ fixer) and set coding style to PSR12 by @unfulvio-godaddy in #181
- Update GitHub templates by @unfulvio-godaddy in #184
- Remove unused .gitmodules file by @unfulvio-godaddy in #185
- Refactor Unit tests namespace by @nmolham-godaddy in #190
- Overhaul thrown exceptions by @unfulvio-godaddy in #191
- Remove WP_Mock TestCase method referencing method removed from PhpUnit by @nmolham-godaddy in #193
- IsEqualHtml should extend PhpUnit Constraint by @unfulvio-godaddy in #194
- Remove WP_Mock/Loader by @unfulvio-godaddy in #196
- Update Hook::safe_offset() to handle closures by @unfulvio-godaddy in #183
- Add TestCase tests and split TestCase mock methods into trait by @unfulvio-godaddy in #197
- Create docs folder for GitBook by @unfulvio-godaddy in #200
- Add gitbook.yaml by @unfulvio-godaddy in #201
- Rename gitbook.yaml to .gitbook.yaml by @unfulvio-godaddy in #202
- Added code coverage for
FuzzyObject. by @rneudorf-godaddy in #203 - Move documentation to Gitbook by @unfulvio-godaddy in #206
- Fix doc links in README.md by @unfulvio-godaddy in #207
- Bump guzzlehttp/psr7 from 2.4.3 to 2.5.0 by @dependabot in #210
- Update DeprecatedMethodListener and add more test coverage by @unfulvio-godaddy in #208
- Add .gitattributes file to exclude dirs from archives by @unfulvio-godaddy in #211
- Fix doc example to install WP_Mock via composer by @unfulvio-godaddy in #214
- Update and add Functions test coverage by @unfulvio-godaddy in #209
- Update Mockery to 1.6 (require PHP 7.4) by @unfulvio-godaddy in #215
- Update License to BSD-3 Clause by @unfulvio-godaddy in #218
- add missing
Support Levelsection by @jeffpaul in #217 - Add invokeInaccessibleMethod and getInaccessiblePropertyValue trait methods by @unfulvio-godaddy in #220
- Update README.md (minor edits for grammar and content) by @unfulvio-godaddy in #222
- Update dependencies and PhpStan return types by @unfulvio-godaddy in #216
- Remove deprecated methods from WP_Mock main class by @unfulvio-godaddy in #221
- Add test coverage to handler and return sequence classes by @unfulvio-godaddy in #219
- Add setInaccessiblePropertyValue helper method and update docs by @unfulvio-godaddy in #223
- Fixes a bug that causes a responder not to run the intercepted method while testing an hook that uses a closure + other minor fixes by @Talpx1 in #224
- Modify type of $args parameter by @wvega-godaddy in #227
- Update return type for mockPost() by @wvega-godaddy in #226
- Update Mockery to 1.6.4 by @unfulvio-godaddy in #228
- Restore CREDITS.md by @unfulvio-godaddy in #230
- Update CHANGELOG and composer version for v1.0.0 release by @unfulvio-godaddy in #231
New Contributors
- @nmolham-godaddy made their first contribution in #190
- @dependabot made their first contribution in #210
- @Talpx1 made their first contribution in #224
- @wvega-godaddy made their first contribution in #227
Full Changelog: 0.5.0...1.0.0
Release notes
Open source →Added
- Added and documented return types in codebase
- New
AccessInaccessibleClassMembershelpers in test case - Move documentation to GitBook
Changed
- Require PHP 7.4
- Update dependencies (Mockery 1.6, PHPUnit 9.6)
- Remove deprecated methods in
WP_Mockmain class - Update
Hook::safe_offset()to handle closure
Fixed
IsEqualHtmlextends PHPUnitConstraint- Improve responder handling of closures
-
0.5.001 Nov 2022Release notes
Open source →What's Changed
- Documentation updates by @jeffpaul in #140
- Add/community files by @jeffpaul in #154
- Change to using
trunkfor this repo by @jeffpaul in #155 - Updated installation instructions to emphasize the requirement of a bootstrap.php file. by @rneudorf-godaddy in #166
- Remove Travis CI and add GitHub workflows CI by @unfulvio-godaddy in #167
- Issue #151 by @phatsk in #152
- Commit composer.lock to git by @unfulvio-godaddy in #170
- Update trunk with readme change from master by @unfulvio-godaddy in #168
- Send test coverage reports to Coveralls via GitHub workflow by @unfulvio-godaddy in #171
- Fix Patchwork not loaded error by @wvega in #165
- Fixed error Call to undefined method ::getAnnotations() by @kudinovfedor in #164
- Fixed mocker function for _n() by @jigneshnakrani088 in #163
- Readme improvements by @over-engineer in #172
- Add AnyInstance matcher. Fix #160 by @BrianHenryIE in #161
- Update changelog by @unfulvio-godaddy in #175
- Update readme by @unfulvio-godaddy in #178
- Updates composer prior to tagging version 0.5.0 by @unfulvio-godaddy in #177
- Update credits by @unfulvio-godaddy in #176
New Contributors
- @jeffpaul made their first contribution in #140
- @rneudorf-godaddy made their first contribution in #166
- @phatsk made their first contribution in #152
- @wvega made their first contribution in #165
- @kudinovfedor made their first contribution in #164
- @jigneshnakrani088 made their first contribution in #163
- @over-engineer made their first contribution in #172
- @BrianHenryIE made their first contribution in #161
Full Changelog: 0.4.2...0.5.0
Release notes
Open source →Added
- New
AnyInstancematcher
Changed
- Add compatibility with PHPUnit 9
- Require PHP 7.3
- Mocker function for
_n()to evaluate singular or plural
Fixed
- Patchwork not loaded error (
WP_Mock::setUsePatchwork(true)was broken) - Address call to undefined method
getAnnotationserror from test class - Support for latest PHPUnit versions
-
0.4.216 Mar 2019Release notes
Open source →Added
- Minor Filter/Action/Hook Assertion Bugfix
- Please note: As with the previously-tagged release, this is not necessarily a stable release!
-
0.4.126 Feb 2019Release notes
Open source →This release brings us up to date with the latest release of PHPUnit.
Please note: As with the previously-tagged release, this is not necessarily a stable release!
What's Changed
New Contributors
Full Changelog: 0.4.0...0.4.1
Release notes
Open source →Added
- PHPUnit 8 Compatibility
- This release brings us up to date with the latest release of PHPUnit.
- Please note: As with the previously-tagged release, this is not necessarily a stable release!
-
0.4.017 Jan 2019Release notes
Open source →This release brings us up to date both with PHPUnit and with PHP itself. The minimum version of PHP now supported by the project is 7.1.
What's Changed
- Add PHP as language in code blocks by @ocularrhythm in #120
- Add a message to the internal functions exception by @johnpbloch in #123
- PHPUnit 7.x Compatibility Fixes by @ericmann in #129
New Contributors
- @ocularrhythm made their first contribution in #120
Full Changelog: 0.3.0...0.4.0
Release notes
Open source →Added
- PHPUnit 7 Compatibility
- This release brings us up to date both with PHPUnit and with PHP itself. The minimum version of PHP now supported by the project is 7.1.
- Please note: As with the previously-tagged release, this is not necessarily a stable release!
-
0.3.003 Dec 2017Release notes
Open source →This release brings us up to date both with PHPUnit and with PHP itself. The minimum version of PHP now supported by the project is 7.0.
What's Changed
- First set of behavioral tests by @johnpbloch in #66
- Add a travis file by @johnpbloch in #67
- Add tests for helper functions by @johnpbloch in #70
- Feature/add assertions for expect not added by @dsawardekar in #48
- Feature/add assertions for expect not added by @johnpbloch in #71
- Move action/filter not added tests into behat by @johnpbloch in #73
- Move expectation return test into unit tests by @johnpbloch in #74
- Added an example of using Mockery to mock WordPress objects by @petenelson in #61
- Add a strict mode by @johnpbloch in #75
- Add predefined commonly used functions by @johnpbloch in #76
- Fix Guidelines link in README by @mathieuhays in #79
- Deprecate wpFunction and wpPassthruFunction by @johnpbloch in #78
- Add common functions to the list of WP_Mock mocked functions by @johnpbloch in #85
- Add a 'conflict' block to composer.json by @johnpbloch in #86
- Patchwork 2.0.3 by @krodyrobi in #92
- Bump PHP Requirements to 5.6 by @ericmann in #100
- Update installation instructions to pull correct branch via composer by @Khristophor in #94
- Add GPLv2 License Text by @ericmann in #99
- [PHPDoc]
$callbackshould be defined as acallabletype by @andreasciamanna in #102 - Added PHPDoc by @andreasciamanna in #104
- Fix typehint for expectFilterAdded method by @psafarov in #108
- Add an expectFilter method by @johnpbloch in #110
- Added support for phpunit 6.0+ by @sudar in #112
New Contributors
- @dsawardekar made their first contribution in #48
- @petenelson made their first contribution in #61
- @mathieuhays made their first contribution in #79
- @krodyrobi made their first contribution in #92
- @Khristophor made their first contribution in #94
- @andreasciamanna made their first contribution in #102
- @psafarov made their first contribution in #108
Full Changelog: 0.1.1...0.3.0
Release notes
Open source →Added
- This release brings us up to date both with PHPUnit and with PHP itself. The minimum version of PHP now supported by the project is 7.0.
- Please note: As with the previously-tagged release, this is not necessarily a stable release!
-
0.2.019 Jul 2017Release notes
Open source →This release moves to using static, tagged versions hosted on Packagist. Aside from a handful of bugfixes, it's equivalent to the
dev-devversion many have been using before July 2017. Moving forward, all versions will be static and tagged.What's Changed
- First set of behavioral tests by @johnpbloch in #66
- Add a travis file by @johnpbloch in #67
- Add tests for helper functions by @johnpbloch in #70
- Feature/add assertions for expect not added by @dsawardekar in #48
- Feature/add assertions for expect not added by @johnpbloch in #71
- Move action/filter not added tests into behat by @johnpbloch in #73
- Move expectation return test into unit tests by @johnpbloch in #74
- Added an example of using Mockery to mock WordPress objects by @petenelson in #61
- Add a strict mode by @johnpbloch in #75
- Add predefined commonly used functions by @johnpbloch in #76
- Fix Guidelines link in README by @mathieuhays in #79
- Deprecate wpFunction and wpPassthruFunction by @johnpbloch in #78
- Add common functions to the list of WP_Mock mocked functions by @johnpbloch in #85
- Add a 'conflict' block to composer.json by @johnpbloch in #86
- Patchwork 2.0.3 by @krodyrobi in #92
- Bump PHP Requirements to 5.6 by @ericmann in #100
- Update installation instructions to pull correct branch via composer by @Khristophor in #94
- Add GPLv2 License Text by @ericmann in #99
- [PHPDoc]
$callbackshould be defined as acallabletype by @andreasciamanna in #102 - Added PHPDoc by @andreasciamanna in #104
New Contributors
- @dsawardekar made their first contribution in #48
- @petenelson made their first contribution in #61
- @mathieuhays made their first contribution in #79
- @krodyrobi made their first contribution in #92
- @Khristophor made their first contribution in #94
- @andreasciamanna made their first contribution in #102
Full Changelog: 0.1.1...0.2.0
Release notes
Open source →Added
- Unstable Distributable Release
- This release moves to using static, tagged versions hosted on Packagist. Aside from a handful of bugfixes, it's equivalent to the
dev-devversion many have been using before July 2017. Moving forward, all versions will be static and tagged. - Please note: As with the previously-tagged release, this is not a stable release! We strongly encourage you to use the 1.0.x-dev source release until we release a stable 1.0 version.
-
0.1.131 Mar 2015 -
0.1.009 Dec 2014Release notes
Open source →Added
- Unstable Distributable Release
- Currently, we only have source releases on Packagist (dev-trunk and 1.0.x-dev). This will be a distributable release that will allow local caching of the library so that not every use needs to be a git clone.
- Please note: this is not a stable release! We strongly encourage you to use the 1.0.x-dev source release until we release a stable 1.0 version.