The Test::MockObject Perl 5 library from the CPAN
Pull request Compare This branch is 38 commits behind chromatic:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Test::MockObject version 1.09


Because you can break this module very badly by using the isa() and can()
methods as if they were functions, version 1.01 started to use the
UNIVERSAL::isa and UNIVERSAL::can modules.  They'll do the right thing but
complain about it so that you can fix the offending code.  These require Perl
5.6.0 or better.

Newer versions of those modules will complain less; see 1.20 of each.

If you want to run all of the tests (including the developer tests that check
the signature and POD coverage), set the environment variable
PERL_RUN_ALL_TESTS to true.  I don't know why you want to do this though,
unless you're me.

I removed T::MO::add() as of version 1.0.  I deprecated it a long, long time
ago.  Also, T::MO::E should handle a few more types of extending now, but
please report any weirdnesses to for this module if you run
into trouble.

The documentation of T::MO::E is correct as of version 0.20.  Also, isa() works
much better in T::MO, thanks to Stevan Little.

You can now skip logging certain mocked methods in T::MO and T::MO::E version 0.15.  Finally!

I've added Test::MockObject:Extends in version 0.14.  This required making
Test::MockObject a little more subclassable.

As of version 0.12, I've fixed the false positives in called_ok().  Jay Bonci
found this one and wrote the test case.  Oops.

As of version 0.11, I've fixed a potential infinite loop with a set_series()
mocked method called in list context.  Yuck.

As of version 0.10, mock objects no longer store their state within the objects
themselves.  That also means that you can have mock objects that aren't hash
references. Nifty.

As of version 0.09, method chaining works for mocking methods.  Handy!  Use it!

As of version 0.07, the add() method has been deprecated in favor of mock().
It continues to work, for backwards compatibility purposes, but you are
encouraged to migrate to mock().  (Thank you for using the module, though.  :)

Test::MockObject is a highly polymorphic testing object, capable of looking
like all sorts of objects.  This makes white-box testing much easier, as you
can concentrate on what the code being tested sends to and receives from the
mocked object, instead of worrying about faking up your own data.  (Another
option is not to test difficult things.  Now you have no excuse.)

Please note that it is possible to write highly detailed unit tests that pass
even when your integration tests may fail.  Testing the pieces individually
does not excuse you from testing the whole thing together.  I consider this to
be a feature.


To install this module type the following:

   $ perl Build.PL
   $ perl ./Build
   $ perl ./Build test
   # ./Build install

You can also use the Makefile.PL.  I don't.


This module requires these other modules and libraries:

    Test::Simple version 0.44 or newer (I fixed a bug :)
    Scalar::Util, without which you have a broken Perl installation post-5.6
    UNIVERSAL::isa and UNIVERSAL::can (always the latest versions)


Copyright (c) 2002 - 2008 chromatic. All rights reserved.  This program is free
software; you can redistribute it and/or modify it under the same terms as Perl
5.10.x itself.