SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

 
 

perl-Test-Mock-Simple rpm build for : OpenSuSE. For other distributions click perl-Test-Mock-Simple.

Name : perl-Test-Mock-Simple
Version : 0.10 Vendor : obs://build_opensuse_org/devel:languages:perl
Release : lp156.1.1 Date : 2024-07-03 19:10:56
Group : Development/Libraries/Perl Source RPM : perl-Test-Mock-Simple-0.10-lp156.1.1.src.rpm
Size : 0.01 MB
Packager : https://www_suse_com/
Summary : Simple Way to Mock Out Parts of or a Whole Module
Description :
This is a simple way of overriding any number of methods for a given
object/class.

Can be used directly in test (or any) files, but best practice (IMHO) is to
create a \'Mock\' module and using it instead of directly using the module in
any tests. The goal is to write a test which passes whether Mocking is
being used or not. See TEST_MOCK_SIMPLE_DISABLE below.

The default behavior is to not allow adding methods that do not exist. This
should stop mistyped method names when attempting to mock existing methods.
See allow_new_methods below to change this behavior.

Why another Mock module? I needed something simple with no bells or
whistles that only overrode certain methods of a given module. It\'s more
work, but there aren\'t any conflicts.

This module can not do anything about BEGIN, END, or other special name
code blocks. To changes these see B\'s (The Perl Compiler Backend) begin_av,
end_av, etc. methods.

Environmental Variables
* TEST_MOCK_SIMPLE_DISABLE

If set to true (preferably 1) then \'add\' is disabled.

Methods
* new

Create a new mock simple object.

* module

The name of the module that is being mocked. The module will be loaded
immediately (by requiring it).

NOTE: since require is being used to load the module it\'s import method
is not being called. This may change in later versions.

* module_location

module_location expects a PATHNAME to the file (relative to the AATTINC
paths) which contains the namespace (or module) that you want to mock.

This is useful when a single file declares multiple namespaces or in
the event of bad coding where the module\'s namespace does not map to
the module\'s location.

Example:

use Test::Mock::Simple;

my $mock = Test::Mock::Simple->new(
module => \'Original::Module\',
module_location => \'Modules/Orignal/Module.pm\',
);

* allow_new_methods

To create methods that do not exist in the module that is being mocked.

The default behavior is to not allow adding methods that do not exist.
This should stop mistyping method names when attempting to mock
existing methods.

* no_load

Default behavior is to load the real module before overriding
individual methods.

If this is not desired set no_load to 1 which will stop this from
happening.

If set then you are required to mock the whole module (or at least
every command required for code to work).

Setting no_load to 1 will force allow_new_methods to 1 as well. This is
done since without the module actually loaded there is no way of
knowing what methods the module has.

* add

This allows for the creation of a new method (subroutine) that will
override the existing one. Think of it as \'add\'ing a mocked method to
override the existing one.

RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-T/15.6/noarch

Content of RPM  Provides Requires

Download
ftp.icm.edu.pl  perl-Test-Mock-Simple-0.10-lp156.1.1.noarch.rpm
     

Provides :
perl(Test::Mock::Simple)
perl-Test-Mock-Simple

Requires :
perl(:MODULE_COMPAT_5.26.1)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1


Content of RPM :
/usr/lib/perl5/vendor_perl/5.26.1/Test
/usr/lib/perl5/vendor_perl/5.26.1/Test/Mock
/usr/lib/perl5/vendor_perl/5.26.1/Test/Mock/Simple.pm
/usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi
/usr/share/doc/packages/perl-Test-Mock-Simple
/usr/share/doc/packages/perl-Test-Mock-Simple/Changes
/usr/share/doc/packages/perl-Test-Mock-Simple/README.md
/usr/share/man/man3/Test::Mock::Simple.3pm.gz

 
ICM