Test::EasyMock::Class - support class method mocking.
use Test::EasyMock qw(:all); use Test::EasyMock::Class qw(create_class_mock); my $mock = create_class_mock('Foo::Bar'); expect($mock->foo(1))->and_scalar_return('a'); replay($mock); Foo::Bar->foo(1); # return 'a' Foo::Bar->foo(2); # Unexpected method call.(A test is failed) verify($mock); # verify all expectations is invoked.
Creates a mock object for class.
To install Test::EasyMock, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::EasyMock
CPAN shell
perl -MCPAN -e shell install Test::EasyMock
For more information on module installation, please visit the detailed CPAN module installation guide.