How to Install and Uninstall perl-Test-MockDateTime Package on openSUSE Leap
Last updated: November 23,2024
1. Install "perl-Test-MockDateTime" package
Please follow the guidelines below to install perl-Test-MockDateTime on openSUSE Leap
$
sudo zypper refresh
Copied
$
sudo zypper install
perl-Test-MockDateTime
Copied
2. Uninstall "perl-Test-MockDateTime" package
Please follow the guidelines below to uninstall perl-Test-MockDateTime on openSUSE Leap:
$
sudo zypper remove
perl-Test-MockDateTime
Copied
3. Information about the perl-Test-MockDateTime package on openSUSE Leap
Information for package perl-Test-MockDateTime:
-----------------------------------------------
Repository : Main Repository
Name : perl-Test-MockDateTime
Version : 0.02-bp155.1.4
Arch : noarch
Vendor : openSUSE
Installed Size : 24.2 KiB
Installed : No
Status : not installed
Source package : perl-Test-MockDateTime-0.02-bp155.1.4.src
Upstream URL : http://search.cpan.org/dist/Test-MockDateTime/
Summary : Mock Datetime->Now Calls During Tests
Description :
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
-----------------------------------------------
Repository : Main Repository
Name : perl-Test-MockDateTime
Version : 0.02-bp155.1.4
Arch : noarch
Vendor : openSUSE
Installed Size : 24.2 KiB
Installed : No
Status : not installed
Source package : perl-Test-MockDateTime-0.02-bp155.1.4.src
Upstream URL : http://search.cpan.org/dist/Test-MockDateTime/
Summary : Mock Datetime->Now Calls During Tests
Description :
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