NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #3413 most downloaded on Packagist
The Phake mock testing library
Latest stable
v4.7.0
Last release 9 months ago
10 Feb 2026
Release timing varies
gaps range from 1 weeks to 13 months
Most releases are documented
notes for 28 of 41 stable releases
Nothing withdrawn
no release was ever pulled
15 years old
52 releases · first in 2012
Drag across the ruler to compare, or tap a release to open it.
Fix SmartDefaultAnswerTest::testCallableReturn() by @TimWolla in https://github.com/phake/phake/pull/333
SmartDefaultAnswerTest::testCallableReturn() by @TimWolla in https://github.com/phake/phake/pull/333Full Changelog: https://github.com/phake/phake/compare/v4.6.2...v4.7.0
#334 Add support for Comparator 8 / PHPUnit 13
Shorthand Stub and Verify notation are deprecated
Replace Phake::when($mock)->foo by Phake::when($mock)->foo(Phake::anyParameters()) and Phake::verify($mock)->foo by Phake::verify($mock)->foo(Phake::anyParameters()).
Remove PHP8.5 deprecation notices
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Remove PHP8.5 deprecation notices
Nothing published for this version
### New Feature #326 Add support for Comparator 7 / PHPUnit 12
#326 Add support for Comparator 7 / PHPUnit 12
Nothing published for this version
Nothing published for this version
FIX - SmartDefaultAnswer is unable to return interface
FIX - SmartDefaultAnswer is unable to return interface
Full Changelog: https://github.com/phake/phake/compare/v4.5.0...v4.5.1
Provide a better type-hint for mock and partial mock objects by @niconoe- in https://github.com/phake/phake/pull/313
Full Changelog: https://github.com/phake/phake/compare/v4.4.0...v4.5.0
## New Feature #312 Add support for Comparator 5 / PHPUnit 10
#312 Add support for Comparator 5 / PHPUnit 10
Add support for PHP8.2 null and false stand-alone types PHP8.2 introduced null and false stand-alone types. It's new possible to mock an object using
Add support for PHP8.2 null and false stand-alone types PHP8.2 introduced null and false stand-alone types. It's new possible to mock an object using those types.
Add support for PHP8.2 DNF Types PHP8.2 introduced Disjunctive Normal Form Types. It's now possible to mock an object using DNF types.
#308 - Unable to use PHP8 named arguments on static method
#307 - Phake\Matchers\IArgumentMatcher doesn't work as expected
### New Features #304 - Add support for PHP8.1 new in initializers PHP8.1 introduced new in initializers Phake 4.2 can now create mock of object using
#304 - Add support for PHP8.1 new in initializers PHP8.1 introduced new in initializers Phake 4.2 can now create mock of object using this feature.
#303 - Add support for PHP8.1 intersection types and never return type
PHP8.1 introduced intersection types and never return type.
Phake 4.2 supports those new types. When a mocked method returning never is called, Phake will by default throw a Phake\Exception\NeverReturnMethodCalledException exception. Calling Phake::when($mock)->thenReturn($x) will have no effect on this method result.
#301 - Add #[\ReturnTypeWillChange] on mocked internal methods on PHP8.1+
All internal mocked method under PHP8.1+ will have #[\ReturnTypeWillChange] attribute to avoid any Deprecation warnings.
Nothing published for this version
Add support for PHP8.0 named parameters PHP8.0 introduced Named arguments
Add support for PHP8.0 named parameters<br /> PHP8.0 introduced Named arguments<br />
$mock = Phake::mock('PhakeTest_MockedClass');
Phake::when($mock)->fooWithLotsOfParameters(parm3: 3, parm2: 2, parm1: 1)->thenReturn(42);
$this->assertSame(42, $mock->fooWithLotsOfParameters(1, 2, 3));
Phake::verify($mock)->fooWithLotsOfParameters(parm3: 3, parm2: 2, parm1: 1);
Add support for PHP8 union types
#[Phake\Mock]Throwable in thenThrow() and not juste ExceptionFix #299 Interfaces with a method called "list" cannot be mocked
This release adds phpunit 9 support.
This release adds phpunit 9 support.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Fixed instances of Phake being used in projects where both old and new versions of PHPUnit classes existed. Defaults to use the newer version.
Fixed instances of Phake being used in projects where both old and new versions of PHPUnit classes existed. Defaults to use the newer version.
No functional changes other than adding ability to use PHPUnit 7.2 and updated to Comparator 3.0.
No functional changes other than adding ability to use PHPUnit 7.2 and updated to Comparator 3.0.
## Fixes * #253 - Use the global Comparator factory. * #261 - Documentation fix
Additional support for PHPUnit 7
Additional support for PHPUnit 7
#226 - Use self type as return type
#258 - Typo
#263, #265 - Add support for PHPUnit 7
Additional support for php 7.1 ## Fixes #250, #251 - Allow mocking classes with nullable parameters (thanks @nijm)
Additional support for php 7.1
#250, #251 - Allow mocking classes with nullable parameters (thanks @nijm)
This release provides support for php 7.1 functionality as well as support for PHPUnit 6. All support for PHP 5 and PHPUnit 5 are officially removed.
This release provides support for php 7.1 functionality as well as support for PHPUnit 6. All support for PHP 5 and PHPUnit 5 are officially removed.
#235, #236 - PHPUnit 6 compatibility enabled #237 - Fatal error when mocking a final class #239, #248 - thenDoNothing() missing on Phake_Proxies_AnswerCollectionProxy #242, #243, #247 - Allow nullable scalar type support
## Fixes * #230 - manage void return type (Thanks @lboulay)
The "get off your butt and merge some PRs" / "Thanks for being patient with me" release
The "get off your butt and merge some PRs" / "Thanks for being patient with me" release
## New Features - #217 Added ability to mock "unsafe classes" - Fixes #214 - #216 Provided a new answer to return self (Phaks::when($mock)->thenReturn
Nothing published for this version
## What's New in 2.2.0 ### Bugfixes #190 - Clean up method that creates mocks This allowed for getting rid of the error suppression operator which app
#190 - Clean up method that creates mocks This allowed for getting rid of the error suppression operator which appeared to cause crashes in PHP 5.6.10
#205 - Performance improvement (thanks @timheilig)
#199 - Allow mocking multiple interfaces at once
#198 - Full support for PHP7 scalar type hints and return types
#196 - Support for mocking methods with variadic arguments
Integrated with Code Climate https://codeclimate.com/github/mlively/Phake
#190 - Clean up method that creates mocks This allowed for getting rid of the error suppression operator which appeared to cause crashes in PHP 5.6.10
Integrated with Code Climate https://codeclimate.com/github/mlively/Phake
Enhanced integration with Travis-CI We are now testing all the things!
#158 - Allow direct calling of protected methods for mocks Allow for calling of private and protected methods on mocks using new Phake::makeVisible() and Phake::makeStaticsVisible() wrappers. This will allow for slightly easier testing of legacy code and abstracts. http://phake.readthedocs.org/en/2.1/mocks.html#calling-private-and-protected-methods-on-mocks
#178 - Renamed thenGetReturnByLambda to thenReturnCallback The thenGetReturnByLambda just didn't quite sound right and was difficult to remember so we changed the name. While the original method will still work, a deprecation error will be emitted by the code when thenGetReturnByLambda is called with a message that you should use thenReturnCallback instead. The great news is that no other project in their right mind would ever use that method name, so a search and replace should be pretty reliable.
#144 - Improve Phake::verify error message When a method doesn't match you will now be given a more appropriate diff as to why. This should help make life a little easier when debugging failing tests.
Enhanced integration with Travis-CI We are now testing all the things!
Integrated with Scrutenizer We are also measuring all the things
Issues Resolved #176 - Facade::generateUniqueClassName generates invalid class names
Issues Resolved #176 - Facade::generateUniqueClassName generates invalid class names
Fixes issues with HHVM. Looks like the root of the issues were some issues in reflection.
Fixes issues with HHVM. Looks like the root of the issues were some issues in reflection.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
- Fixes a bc break for <php5.3.9
Nothing published for this version
Nothing published for this version
Includes auto-detecting which client to use and using the existing constructor for mock classes so as to work with interfaces that define the construc
Includes auto-detecting which client to use and using the existing constructor for mock classes so as to work with interfaces that define the constructor.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Fixed #138 - Using default answers with interfaces
Fixed #138 - Using default answers with interfaces
Fixes #137 - Mocking interfaces with a constructor
Fixes #137 - Mocking interfaces with a constructor
Nothing published for this version
One column per quarter.