Closed marmotz closed 11 years ago
All orphanized, shunted and overloaded methods was reset after mock class generation, so i think that your proposal is useless (see https://github.com/atoum/atoum/blob/master/classes/mock/generator.php#L197 for more informations).
As written in my 2nd comment of my 1st code block, the purpose is to create a shortcut to $this->calling($mock)->myMethod = function() {}
, not to shunt a future generated mock but to shunt a method to an existing mock for the next test to run.
Oh sorry for the mistake.
It's not technically possible to do that because the mocked class can have a method with name orphanize
or unorphanize
.
However, you can replace $this->calling($mock)->myMethod = function() {}
by $this->calling($mock)->myMethod = null
.
So, you want something like $this->calling($mock)->myMethod->doNothing()
?
And you want to be able to do something like $this->calling($mock)->myMethod->doSomething()
?
So you can be happy because it's now possible since commit 3ecffa80cff4c8bbfa21a39160d79f4349248dec!
Is it possible to add shortcut like this:
And, why not add also:
I use
$this->calling()
syntax, but if you want to create/use an other one... :) I useorphanize
as method name, but if you want to useshunt
or an other one... :)