-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
When specifying expected arguments using .args() Mockolate should verify the argument count where possible.
Example
public class ArgumentCountExample
{
public function methodNoArgs():void {}
public function methodRequiredArgs(req1:Object, req2:Object):void {}
public function methodOptionalArgs(opt:Object = null):void {}
public function methodRestArgs(...rest):void {}
public function methodMixedArgs(req:Object, opt:Object = null, ..rest):void {}
}// accepted
mock(example).method('methodNoArgs').noArgs();
mock(example).method('methodRequiredArgs').args(1, 2);
mock(example).method('methodOptionalArgs').args(1);
mock(example).method('methodRestArgs').args(1, 2, 3);
mock(example).method('methodRestArgs').args(1, 2, 3);
mock(example).method('methodMixedArgs').args(1, 2);
mock(example).method('methodMixedArgs').args(1, 2, 3);
// denied
mock(example).method('methodNoArgs').args(1); // should throw TooManyArgumentsError
mock(example).method('methodRequiredArgs').args(1); // should throw TooFewArgumentsError
mock(example).method('methodOptionalArgs').args(1, 2); // should throw TooManyArgumentsErrorMetadata
Metadata
Assignees
Labels
No labels