Giuseppe Mazzapica
Captivated by WordPress development during his architecture studies, Giuseppe couldn't escape the web dev industry for the next two decades.
WP expert and eager open source contributor, he used to say he spoke PHP better than English.
Despite his undiminished interest in software development and architecture, his job has lately been more about engineering leadership and strategy than code.
These days, he's struggling more with the "socio-" part of his socio-technical job.
@dseguy@phpc.social It's all about knowledge and coupling.
For C to call A, it needs to know A well enough to decide it really wants to call that particular ancestor behavior instead of its direct parent.
This level of knowledge (coupling) is quite bad, and it's widely accepted that inheritance is bad for this, right?
Honestly, the fact the language makes calling arbitrary ancestors behavior with shared state (because if the method contains $this it will resolve to C) it is a good thing IMO :)
@emd@cosocial.ca First, if it's a class method, don't use Brain Monkey, but the Mockery directly. Brain Monkey brings Mockery features to functions, for object methids you don't need it.
Anyway, the mock/stub is reset when you call Monkey\tearDown() at the end of every test case (in PHPUnit you do It in test class' tearDown()).
If in the same test case you need different mock/stub for same function, just do the stub/mock again. The second time it will override what you had before.