Name : perl-Test-Mock-One
| |
Version : 0.011
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp156.1.1
| Date : 2024-07-03 19:10:44
|
Group : Development/Libraries/Perl
| Source RPM : perl-Test-Mock-One-0.011-lp156.1.1.src.rpm
|
Size : 0.02 MB
| |
Packager : https://www_suse_com/
| |
Summary : Mock the world with one object
|
Description :
Be able to mock many things with little code by using AUTOLOAD.
The problem this module tries to solve is to allow testing many things without having to write many lines of code. If you want to create mock objects you often need to write code like this:
{ no warnings qw(redefine once); local *Foo::thing = sub { return bless({}, \'Baz\'); }; local *Baz::foo = sub { return 1 }; local *Baz::bar = sub { return 1 }; local *Baz::baz = sub { return 1 }; use warnings;
}
Test::Mock::One allows you to write a simple object that allows you to do the same with
my $mock = Test::Mock::One->new(foo => 1, bar => 1, baz => 1); my $override = Sub::Override->new(\'Foo::thing\' => sub { return $mock });
You don\'t actually need to define anything, by default method on a Test::Mock::One object will return itself. You can tweak the behaviour by how you instantiate the object. There are several attributes that control the object, these are defined as X-Mock attributes, see Test::Mock::One/METHODS for more on this.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-T/15.6/noarch |