This repository has been archived by the owner on Jul 8, 2023. It is now read-only.
Review how mocked types and ad hoc mock definitions are supplied to mocking functions #117
Labels
Milestone
Currently ad hoc mocks are specified like this:
But since the first argument to
mock()
(i.e.$types
) already accepts a variety of inputs, it could probably accept definition values directly. They could be distinguished from arrays of multiple types by checking whether the$types
has sequential keys:This would probably make both
mock()
and, particularly,partialMock()
more intuitive.The other factors in this equation are mocking of anonymous classes and generic objects, and "mocks that forward to a real instance" (#39).
I recently implemented support for anonymous classes in a branch. It involved accepting an instance of an anonymous class as a type, and doing the following:
Afterwards, I realised that this almost does what #39 is trying to achieve. Perhaps there's a solution that will cover all these problems, whilst making the interface clearer.
The text was updated successfully, but these errors were encountered: