forked from chromatic/Test-MockObject
/
README
83 lines (59 loc) · 3.23 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Test::MockObject version 1.09
=============================
* NOTES *
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 http://rt.cpan.org/ 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.
INSTALLATION
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.
DEPENDENCIES
This module requires these other modules and libraries:
Test::Simple version 0.44 or newer (I fixed a bug :)
Test::Exception
Scalar::Util, without which you have a broken Perl installation post-5.6
UNIVERSAL::isa and UNIVERSAL::can (always the latest versions)
COPYRIGHT AND LICENCE
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.