You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** * @method InvocationStubber method($constraint) * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */interface Stub
{
}
The test double code generator checks whether the interface(s) (or class) to be doubled have a method named method.
If there is no such method then the generated class will have a method named method that allows the configuration of methods on the test double object:
If the interface(s) (or class) to be doubled have a method named method then the test double code generator will leave that method as-is. In this case, the example shown above has to be written like so:
This implementation, which only exists because of an unlikely edge case (when do you call a method method?), results in unnecessary complexity which I would like to get rid of. Furthermore, the expects() method should only exist on mock objects (e.g. created with createMock()), but not on test stubs (e.g. created with createStub()).
Once the support for doubling interfaces (or classes) that have a method named method has been removed, the Stub interface can be changed to look like so:
/** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */interface Stub
{
publicfunctionmethod($constraint): InvocationStubber;
}
At that point in time we can also change createStub() et. al. to return an object that does not have expects().
The text was updated successfully, but these errors were encountered:
Right now, the
Stub
interface looks like this:The test double code generator checks whether the interface(s) (or class) to be doubled have a method named
method
.If there is no such method then the generated class will have a method named
method
that allows the configuration of methods on the test double object:If the interface(s) (or class) to be doubled have a method named
method
then the test double code generator will leave that method as-is. In this case, the example shown above has to be written like so:This implementation, which only exists because of an unlikely edge case (when do you call a method
method
?), results in unnecessary complexity which I would like to get rid of. Furthermore, theexpects()
method should only exist on mock objects (e.g. created withcreateMock()
), but not on test stubs (e.g. created withcreateStub()
).Once the support for doubling interfaces (or classes) that have a method named
method
has been removed, theStub
interface can be changed to look like so:At that point in time we can also change
createStub()
et. al. to return an object that does not haveexpects()
.The text was updated successfully, but these errors were encountered: