Skip to content

Releases: sirbrillig/spies

v1.10.2

10 Feb 23:12
2b19c09
Compare
Choose a tag to compare

Changelog

  • Fix infinite loop on restub invoke (#30)

v1.10.1

09 Feb 00:31
8158560
Compare
Choose a tag to compare

Changelog

  • Forget the name of the global functions on restore (#28) (props @mehamasum)

v1.10.0

30 Oct 22:15
099c0c8
Compare
Choose a tag to compare

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 and AnyValue matchers in reports.

v1.9.0

23 Oct 18:17
Compare
Choose a tag to compare

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

25 Sep 21:50
Compare
Choose a tag to compare

Changelog

  • Add \Spies\match_pattern() which can be used as an argument to any call to with() (in Expectations or Stubs) to apply a PCRE to a string, rather than having to match the string exactly.

v1.7.1

18 Aug 20:06
Compare
Choose a tag to compare

Changelog

  • Fix a bug wherein sometimes match_array() and do_arrays_match() would fail when the arrays are identical.

v1.7.0

17 Aug 20:12
Compare
Choose a tag to compare

Changelog

  • Add \Spies\match_array() which can be used as an argument to any call to with() (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

09 Aug 17:42
Compare
Choose a tag to compare

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

17 Feb 15:38
Compare
Choose a tag to compare

Reverts changes made in v1.4.1 and v1.5.1 as I think I was wrong to copy objects. Objects are passed by reference and should be treated that way by Spies. Unexpected mutations are part of the language and should be considered while writing tests.

v1.5.1

17 Feb 00:24
Compare
Choose a tag to compare

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.