=pod

=head1 NAME

Test::MonkeyMock

=head1 SYNOPSIS

    # Create a new mock object
    my $mock = Test::MonkeyMock->new;
    $mock->MOCK(foo => sub {'bar'});
    $mock->foo;

    # Mock existing object
    my $mock = Test::MonkeyMock->new(MyObject->new());
    $mock->MOCK(foo => sub {'bar'});
    $mock->foo;

    # Check how many times the method was called
    my $count = $mock->CALLED('foo');

    # Check what arguments were passed on the first call
    my @args = $mock->CALL_ARGS('foo');

    # Check what arguments were passed on the second call
    my @args = $mock->CALL_ARGS('foo', 1);

=head1 DESCRIPTION

Why? I used and still use L<Test::MockObject> and L<Test::MockObject::Extends>
a lot but sometimes it behaves very strangely introducing hard to find global
bugs in the test code, which is very painful, since the test suite should have
as least bugs as possible. L<Test::MonkeyMock> is somewhat a subset of
L<Test::MockObject> but without side effects.

L<Test::MonkeyMock> is also very strict. When mocking a new object:

=over

=item * throw when using C<CALLED> on unmocked method

=item * throw when using C<CALL_ARGS> on unmocked method

=back

When mocking an existing object:

=over

=item * throw when using C<MOCK> on unknown method

=item * throw when using C<CALLED> on unknown method

=item * throw when using C<CALL_ARGS> on unknown method

=back

=head1 AUTHOR

Viacheslav Tykhanovskyi, C<vti@cpan.org>.

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2012, Viacheslav Tykhanovskyi

This program is free software, you can redistribute it and/or modify it under
the terms of the Artistic License version 2.0.

=cut
