Releases: sirbrillig/spies
v1.10.2
v1.10.1
Changelog
- Forget the name of the global functions on restore (#28) (props @mehamasum)
v1.10.0
Changelog
With this release, Spies should be able to work totally independently of PHPUnit.
- Refactored Expectations to remove reliance on PHPUnit.
- Conditionally load PHPUnit custom assertions only if PHPUnit is loaded.
- Improve readability of
MatchArray
,MatchPattern
andAnyValue
matchers in reports.
v1.9.0
Changelog
Add the ability to create delegate objects with MockObject
. This modifies MockObject
such that if provided with a class instance rather than a class name, it will delegate all method calls on the mock object to the delegate instance.
However, the mock will still retain the features of a MockObject
, like being able to add additional methods (using add_method()
) and being able to spy on method calls (using spy_on_method()
).
This change makes it possible to create a sort of proxy object which functions as normal, but allows spying on its method calls.
It also means that it's possible to mock certain methods of an object while retaining the full functionality of other methods.
v1.8.0
v1.7.1
Changelog
- Fix a bug wherein sometimes
match_array()
anddo_arrays_match()
would fail when the arrays are identical.
v1.7.0
Changelog
- Add
\Spies\match_array()
which can be used as an argument to any call towith()
(in Expectations or Stubs) to partially match an array, rather than having to specify all the array elements. - Add
\Spies\do_arrays_match()
which is a helper function that can be used anywhere and returns true if the first argument partially matches the second.
v1.6
Changelog
This is mostly a bug fix release, but the behavior could be quite different in some situations so I'm making it a minor version.
Now we allow returning falsey values (null
, []
, ''
, false
) in mocked functions.
v1.5.2
v1.5.1
If an object is passed as an argument to a Spy call, since v1.4.1 that object is copied before being saved for comparison. Unfortunately, this has the result that comparing the original object to its copy always returns false (since they are compared by reference and the copy is literally not the same).
This release changes the comparison function to try comparing the objects by an array representation also.