Index index by Group index by Distribution index by Vendor index by creation date index by Name Mirrors Help Search

perl-Test-MockDateTime-0.02-bp155.1.4 RPM for noarch

From OpenSuSE Leap 15.5 for noarch

Name: perl-Test-MockDateTime Distribution: SUSE Linux Enterprise 15 SP5
Version: 0.02 Vendor: openSUSE
Release: bp155.1.4 Build date: Wed May 17 16:05:48 2023
Group: Development/Libraries/Perl Build host: lamb56
Size: 24792 Source RPM: perl-Test-MockDateTime-0.02-bp155.1.4.src.rpm
Packager: https://bugs.opensuse.org
Url: http://search.cpan.org/dist/Test-MockDateTime/
Summary: Mock Datetime->Now Calls During Tests
Getting the current time sometimes is not very helpful for testing
scenarios. Instead, if you could obtain a known value during the runtime of
a testcase will make your results predictable.

Why another Date Mocker? I wanted something simple with a very concise
usage pattern and a mocked date should only exist and stay constant inside
a scope. After leaving the scope the current time should be back. This lead
to this tiny module.

This simple module allows faking a given date and time for the runtime of a
subsequent code block. By default the 'on' keyword is exported into the
namespace of the test file. The date to get mocked must be in a format that
is recognized by DateTime::Format::DateParse.

    on '2013-01-02 03:04:05', sub { ... };

is basically the same as

    {
        my $now = DateTime::Format::DateParse->parse_datetime(
            '2013-01-02 03:04:05'
        );

        local *DateTime::now = sub { $now->clone };

        ... everything from code block above
    }

A drawback when relying on this module is that you must know that the
module you are testing uses 'DateTime->now' to obtain the current time.
=cut

Provides

Requires

License

Artistic-1.0 or GPL-1.0+

Changelog

* Mon May 11 2020 Frank Schreiner <FSchreiner@suse.com>
  - initial version of package (0.02)

Files

/usr/lib/perl5/vendor_perl/5.26.1/Test
/usr/lib/perl5/vendor_perl/5.26.1/Test/MockDateTime.pm
/usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi
/usr/share/doc/packages/perl-Test-MockDateTime
/usr/share/doc/packages/perl-Test-MockDateTime/Changes
/usr/share/doc/packages/perl-Test-MockDateTime/LICENSE
/usr/share/doc/packages/perl-Test-MockDateTime/README
/usr/share/doc/packages/perl-Test-MockDateTime/README.md
/usr/share/man/man3/Test::MockDateTime.3pm.gz


Generated by rpm2html 1.8.1

Fabrice Bellet, Tue Apr 9 19:57:54 2024