Skip to content
This repository has been archived by the owner on Jul 8, 2023. It is now read-only.

Latest commit

 

History

History
697 lines (540 loc) · 28.4 KB

CHANGELOG.md

File metadata and controls

697 lines (540 loc) · 28.4 KB

Phony changelog

Unreleased

  • [BC BREAK] PHP 7.3 is no longer supported.
  • [BC BREAK] PHP 7.4 is no longer supported.
  • [NEW] Added experimental support for PHP 8.0 named arguments (#251).
    • Generated mocks and function hooks now use the original parameter names from the underlying method/function. This means they can be called with the same named arguments as their "real" counterparts, so long as the named argument corresponds to a parameter name defined in the method/function signature. In other words, named arguments should work as expected unless they're being collected by a variadic (...) parameter.
    • None of Phony's APIs support supplying named arguments yet. This means you will still need to specify arguments positionally when matching stub arguments, verifying call input, and anything else to do with arguments.
  • [NEW] Added support for PHP 8.1 (#255, #256 - thanks @keksa).
  • [NEW] Added support for PHP 8.1 intersection types (#259).
  • [NEW] Added support for PHP 8.1 enumerations (#261).
  • [NEW] Added support for PHP 8.1 never return types.
  • [NEW] Added support for PHP 8.1 readonly properties in ad hoc mocks (#260).
  • [NEW] Added support for PHP 8.2 (#257, #258 - thanks @danepowell).
  • [NEW] Added support for PHP 8.2 disjunctive normal form (DNF) types (#263).
  • [NEW] Added support for PHP 8.2 true types (#262).
  • [NEW] Added support for PHP 8.2 false standalone types (#262).
  • [NEW] Added support for PHP 8.2 null standalone types (#262).
  • [NEW] Added support for PHP 8.2 readonly classes (#264).
  • [NEW] emptyValue() now accepts a $resolveSelf argument, which can be used to return a resolved class name to use when the supplied $type value includes a self or static type.
  • [IMPROVED] The exporter now uses a single sequence of numbers to identify arrays, objects, and wrappers. Previously a separate sequence of numbers was used for arrays, due to a limitation of older PHP versions. This means identifier numbers are now unique across all exporter outputs, which should make cross-referencing easier.
  • [IMPROVED] The exporter no longer needs to disambiguate references by indicating their type (e.g. &1[], &2{}, &3()), since all types now share a single sequence of identifier numbers. References will now be rendered as just an ampersand followed by the identifier number (e.g. &1, &2, &3).
  • [FIXED] Mocking traits that use self types no longer causes fatal errors (#268).
  • [FIXED] The exporter no longer omits falsy labels like '0'.
  • [FIXED] Mocks of methods with static return types no longer fail when the empty value factory attempts to create a return value.

5.0.2 (2021-02-17)

  • [FIXED] An exception is no longer thrown under non-CLI SAPIs when detecting ANSI color support (#252 - thanks @yanneg).

5.0.1 (2021-02-08)

  • [FIXED] Functions and methods with "unavailable" default values no longer cause exceptions to be thrown when attempting to determine the default value.

5.0.0 (2020-12-21)

  • [BC BREAK] PHP 7.2 is no longer supported.
  • [NEW] Added support for PHP 8 union types (#250).
  • [NEW] Added support for PHP 8 false types (#250).
  • [NEW] Added support for PHP 8 mixed types (#250).
  • [NEW] Added support for PHP 8 static return types (#250).
  • [NEW] Added support for parent types (#250).

Known issues

  • PHP 8 named arguments are not supported.
  • No guarantees are made about which specific value will be returned from a stub (or mock method) with a union return type, when no explicit return value is specified. The value may differ depending on the order in which the union type's members appear.

4.0.1 (2020-08-29)

  • [FIXED] Nullable variadics can now be mocked (#248 - thanks @keksa).

4.0.0 (2019-12-31)

  • [BC BREAK] PHP 7.1 is no longer supported.
  • [NEW] Added support for specifying ad hoc mock property types (#247).
  • [IMPROVED] Improved exporter output for array references (#244).
  • [IMPROVED] Improved exporter output for weak references (#245).
  • [IMPROVED] Improved type hints and type declarations for better integration with PHPStan.

3.2.0 (2019-10-30)

  • [IMPROVED] Compatibility with the current PHP 7.4 release candidate (#246).

3.1.0 (2018-12-07)

  • [IMPROVED] Support for PHP 7.3 features (#239).

3.0.1 (2018-06-07)

  • [FIXED] Fixed a bug where creating handles for uncallable methods with final class return types would throw exceptions (#237 - thanks @pmall).

3.0.0 (2018-03-13)

See the migration guide for detailed upgrade information.

  • [BC BREAK] PHP 7.0 is no longer supported (#233).
  • [BC BREAK] An explicit argument is now required in setUseColor().
  • [BC BREAK] The handle->clazz() method was renamed to handle->class().

2.0.1 (2017-10-06)

2.0.0 (2017-09-29)

See the migration guide for detailed upgrade information.

  • [BC BREAK] PHP 5 is no longer supported (#216).
  • [BC BREAK] HHVM is no longer supported (#216, #219).
  • [BC BREAK] Removed inOrderSequence, checkInOrderSequence, anyOrderSequence, and checkAnyOrderSequence from the facade (#215).
  • [BC BREAK] Stubs created outside of a mock now have their "self" value set to the stub itself, instead of the stubbed callback (#226).
  • [NEW] Implemented anInstanceOf() (#220).
  • [NEW] Implemented emptyValue() (#218).
  • [IMPROVED] Support for PHP 7.2 features, including the object typehint (#224).
  • [IMPROVED] Improved the error message produced when a default return value cannot be produced, because the return type is a final class (#228).
  • [IMPROVED] Reduced the amount of output generated when mocks, stubs, and spies are encountered by var_dump() (#223).

1.0.1 (2017-07-04)

  • [FIXED] Matcher verification no longer uses deprecated each() function.

1.0.0 (2017-04-24)

  • [BC BREAK] Third-party test framework integrations have been moved to separate Composer packages (#216).
  • [BC BREAK] Dropped support for Counterpart, Mockery, Phake, and Prophecy matchers (#216).

Migrating to 1.x

No code changes should be required, but in some cases, the Composer package name and version constraint will need to be updated:

  • If you're using Phony under PHPUnit:
    • Change the Composer package from eloquent/phony to eloquent/phony-phpunit.
    • Pick the appropriate version constraint for the version of PHPUnit you intend to use. See the eloquent/phony-phpunit repository for more information.
  • If you're using Phony under Peridot:
    • If you were using eloquent/peridot-phony, change the Composer package to eloquent/phony-peridot.
    • If you were using eloquent/phony, no changes are required, but consider trying eloquent/phony-peridot for the added auto-wired mock support. See the eloquent/phony-peridot repository for more information.
  • If you're using Phony under SimpleTest, change the Composer package from eloquent/phony to eloquent/phony-simpletest.
  • If you're using Phony under Pho, change the Composer package from eloquent/phony to eloquent/phony-pho.
  • For other frameworks, or standalone use, no changes are required.

0.14.7 (2017-04-22)

  • [FIXED] The "last error" state is now cleared when using the feature detector (#209, #214).

0.14.6 (2017-01-03)

  • [FIXED] Partial mocks of abstract functions with return types now work as intended (#212).
  • [FIXED] Fixed regression of #203 and #204.

0.14.5 (2016-12-07)

  • [FIXED] Mock handle substitution fixed for threw() and receivedException() verifications (#211).
  • [IMPROVED] Inline exporter now uses tilde (~) to indicate truncated content (#210).
  • [IMPROVED] Refactored the feature detector.

0.14.4 (2016-11-23)

  • [FIXED] Fixed mocking of classes with self return type (#208).

0.14.3 (2016-11-13)

  • [FIXED] Suppress posix_isatty warnings that occur when PHPUnit process isolation is in use (#207 - thanks @keksa).

0.14.2 (2016-11-10)

  • [FIXED] Fixed nullable return type support for newer PHP 7.1 release candidates (#206).

0.14.1 (2016-11-04)

  • [FIXED] Checking for nullable type support no longer causes fatal errors under HHVM (#203, #204 - thanks @shadowhand).

0.14.0 (2016-09-30)

  • [BC BREAK] Removed calledOn() (#197).
  • [IMPROVED] Generator spies and iterable spies are now substituted in argument matching and verification (#193).
  • [IMPROVED] Documentation improvements (#191, #192, #198).

0.13.5 (2016-09-20)

  • [IMPROVED] Support for PHP 7.1 iterable pseudo-type (#195).
  • [IMPROVED] Support for PHP 7.1 void pseudo-type (#195).
  • [IMPROVED] Support for PHP 7.1 nullable types (#195).
  • [IMPROVED] Disallow ASCII delete in symbol names, matching the change in PHP 7.1 (#195).

0.13.4 (2016-08-17)

0.13.3 (2016-08-07)

  • [FIXED] Verification results now return call verifiers instead of unwrapped calls (#185).

0.13.2 (2016-08-05)

  • [FIXED] Fixed mocking of destructors (#183).

0.13.1 (2016-08-02)

  • [IMPROVED] Improved support for mocking many problematic classes (#182).

0.13.0 (2016-07-15)

  • [BC BREAK] Renamed $handle->mock() to $handle->get() (#180).
  • [BC BREAK] Removed verify() and verifyStatic() (#179).
  • [BC BREAK] Removed magic calls from mock handles. All stubbing must now use with(), and all call argument verification must now use calledWith() (#179).
  • [IMPROVED] Improved exporting of mock handles, stubs, spies, and closures (#177).

0.12.0 (2016-07-13)

  • [BC BREAK] Replaced the term "traversable" with "iterable". Any function or method with "traversable" in the name has also been renamed accordingly (#164).
  • [BC BREAK] Stubs now return empty values by default, instead of forwarding (#174).

0.11.0 (2016-07-12)

  • [NEW] Implemented stubGlobal() (#163).
  • [NEW] Implemented spyGlobal() (#175).
  • [IMPROVED] Traversable spies now implement ArrayAccess and Countable (#165).

0.10.2 (2016-07-06)

  • [IMPROVED] Complete overhaul of verification output, with improvements to the output of all verifications (#161, #170).
  • [IMPROVED] Improved exporting of closures under HHVM (#166).
  • [FIXED] Fixed calledOn() behavior (#160).
  • [FIXED] Fixed verification output under Windows (#167).
  • [FIXED] Error reporting is now correctly restored in all cases (#168).
  • [FIXED] Fixed the recording of static magic method calls (#169).

0.10.1 (2016-06-07)

  • [FIXED] Fixed magic self parameters in ad hoc mock definitions (#158).
  • [FIXED] Fixed mocking of internal classes that implement Traversable and other unimplementable interfaces directly (#159).

0.10.0 (2016-05-25)

  • [BC BREAK] Removed produced(), producedAll(), received(), receivedException() and associated check verification methods in both the spy and call APIs. These methods are replaced by generator and traversable verifiers (#125).
  • [BC BREAK] Usage of setsArgument(), callsArgument(), callsArgumentWith(), and returnsArgument() can now result in exceptions when a specified argument is undefined at call time (#136).
  • [BC BREAK] Removed arguments() and argument() from all event collections, in favor of using firstCall() et al. followed by the corresponding method on the call API (#146).
  • [NEW] Implemented generator and traversable verifiers (#102, #115, #125).
  • [NEW] Implemented responded() and completed() verifications (#125).
  • [NEW] Mocks as default stub return values for arbitrary object return types (#149, #150).
  • [FIXED] Fixed exception when stubbing functions with return values (#147).
  • [FIXED] Fixed mocking of Traversable (#152).
  • [FIXED] Fixed mocking of DateTimeInterface (#153).
  • [FIXED] Fixed mocking of classes with final constructors (#154).

0.9.0 (2016-04-27)

  • [NEW] Implemented generator stubs (#11, #140, #144).
  • [IMPROVED] More default values for built-in return types (#138, #139).
  • [FIXED] Omitted arguments no longer pass for any() matcher (#137).
  • [FIXED] Fixed memory leak under PHP 7 (#143).

0.8.0 (2016-02-12)

  • [BC BREAK] Mocking functions now accept ad hoc definitions in the $types argument, hence the $definition argument has been removed from mock(), partialMock(), and mockBuilder() (#117).
  • [BC BREAK] Mocking functions mock(), partialMock(), and mockBuilder() no longer accept the $className argument. Custom class names can still be used via named() on mock builders (#117).
  • [BC BREAK] Mocking functions mock(), partialMock(), and mockBuilder() no longer accept reflection classes or mock builders in the $types argument (#117).
  • [BC BREAK] Mock definition values can no longer be generic objects (#117).
  • [BC BREAK] Removed the $useGeneratorSpies and $useTraversableSpies argument from both spy() and stub() (#123).
  • [BC BREAK] Removed the $self and $defaultAnswerCallback arguments from stub() (#123).
  • [BC BREAK] Rewrite and rename of mock builder API methods for creating mocks (#103).
  • [BC BREAK] Renamed "proxy" to "handle" in line with documentation (#133).
  • [BC BREAK] Replaced reset() with stopRecording() and startRecording() (#99).
  • [BC BREAK] Event no longer implements event collection (#134).
  • [NEW] Mock builders can now be copied via the clone operator (#101).
  • [NEW] Implemented proxy() on mock handles (#39).
  • [IMPROVED] Made API setter style methods fluent (#98).
  • [IMPROVED] Instance handles are automatically adapted when stubbing and verifying (#126).
  • [IMPROVED] Added checks for unused stub criteria (#126).
  • [IMPROVED] Default answer callbacks are now a first-class concept for mocks (#90).
  • [IMPROVED] Stubs now return valid default values for most "in built" return type declarations (#109).
  • [IMPROVED] Verification results (event collections) now implement firstEvent() and lastEvent() (#97).
  • [IMPROVED] Requesting the return value or exception of a call that has not responded now throws an exception (#92).
  • [FIXED] Fixed bug when mocking traits with magic call methods (#127).
  • [FIXED] Mocking, and calling of return-by-reference methods no longer causes errors to be emitted (#105).
  • [FIXED] Ad hoc mocks that differ only by function body no longer result in re-use of the same mock class (#131).

0.7.0 (2015-12-20)

  • [NEW] Implemented firstCall() and lastCall() (#93).
  • [IMPROVED] Support for PHP 7 engine error exceptions (#119).
  • [IMPROVED] Support for PHP 7 scalar type hints (#106 - thanks @jmalloc).
  • [IMPROVED] Support for PHP 7 return type declarations (#104, #108 - thanks @jmalloc).
  • [IMPROVED] Support for PHP 7 methods names that match tokens (#110 - thanks @jmalloc).
  • [IMPROVED] Partial support for PHP 7 generator returns (#111 - thanks @jmalloc).
  • [IMPROVED] Tidied up many interfaces and doc blocks.

0.6.4 (2015-12-19)

  • [FIXED] Simplified method resolution rules. Fixes issue when mocking interfaces and traits (#112).

0.6.3 (2015-12-18)

  • [FIXED] Fixed custom mocks with invocable objects as method implementations (#113).
  • [FIXED] Fixed required, but nullable parameters in function signatures (#114).

0.6.2 (2015-12-16)

  • [IMPROVED] Huge additions to the documentation (#85, #88).
  • [FIXED] Fixed error with EqualToMatcher when comparing object to non-object (#100).

0.6.1 (2015-11-16)

  • [IMPROVED] Mock instances labels are now compared by the equal to matcher (#91).
  • [IMPROVED] The inline exporter now outputs mock labels (#91).

0.6.0 (2015-11-12)

  • [NEW] Support for stub default answer callbacks.
  • [FIXED] Fixed full mock default answer bug (#89).

0.5.2 (2015-11-05)

  • [FIXED] Fixed stripping of exception xdebug message in exporter and equal to matcher (#87).
  • [DOCUMENTATION] Added documentation.

0.5.1 (2015-10-22)

  • [IMPROVED] Prevent exporter and matcher from traversing into mock internals (#82).
  • [FIXED] Fixed assertion recording bug with noInteraction() (#83).

0.5.0 (2015-10-20)

  • [BC BREAK] Removed fullMock(), changed mock() to create full mocks, and added partialMock() for creating partial mocks (#73).

0.4.0 (2015-10-20)

  • [IMPROVED] Implemented new 'equal to' matcher (#70 - thanks @jmalloc).
  • [IMPROVED] Improved rendering of assertion failure messages (#71).
  • [IMPROVED] String messages now allowed by throws() (#76).
  • [FIXED] Fixed magic method mocking bug (#74).
  • [FIXED] Fixed mocking of exceptions under HHVM (#75).
  • [FIXED] Attempting to stub a final method now throws an exception (#77).

0.3.0 (2015-07-22)

  • [NEW] PHP 7 support.
  • [NEW] Support for variadic functions (#64 - thanks @jmalloc).
  • [NEW] Implemented eventAt() and callAt() for verification results (#17).
  • [NEW] Implemented Call::argument() (#56).
  • [NEW] Implemented MockBuilder::source() for easier debugging (#45).
  • [NEW] Implemented anyOrder() (#60).
  • [IMPROVED] Vast improvements to verification failure output (#66).
  • [IMPROVED] Allow use of phonySelf parameter everywhere (#63).
  • [IMPROVED] Optimizations to the matcher driver system (#67).
  • [IMPROVED] Optimizations to the equal to matcher (#69).
  • [IMPROVED] Calls to eval() no longer use @ suppression.

0.2.1 (2015-02-28)

  • [FIXED] Cardinality checks for received() now work as expected (#54).
  • [FIXED] Methods names are correctly treated as case-insensitive (#58).
  • [FIXED] Can mock an interface that extends Traversable (#59).
  • [FIXED] Calling of trait constructors (#61).

0.2.0 (2014-11-18)

  • [BC BREAK] Renamed IDs to labels.
  • [NEW] Verify no interaction (#27).
  • [NEW] Manual constructor calling (#36, #46).
  • [NEW] Setters for labels (#35).
  • [NEW] Peridot integration (#50).
  • [NEW] Pho integration (#51).
  • [NEW] SimpleTest integration (#20).
  • [FIXED] Trait mocking is now working (#42, #49).
  • [FIXED] Stubbing interface bugs (#53).
  • [IMPROVED] Better assertion messages (#41).
  • [IMPROVED] Generator spies under HHVM (#29).
  • [IMPROVED] Better mock definition equality checking (#47).
  • [IMPROVED] Throw an exception when passing the wrong types to inOrder() (#52).
  • [IMPROVED] Magic 'self' parameter detection (#48).

0.1.1 (2014-10-26)

  • [IMPROVED] Performance improvements when repeatedly mocking the same types (#44).
  • [IMPROVED] Performance improvements when mocking large classes (#44).
  • [IMPROVED] Improved exception message when mocking an undefined type (#40).

0.1.0 (2014-10-21)

  • [NEW] Initial implementation.