Created
December 9, 2013 14:43
-
-
Save mackee/7873278 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Test::MockTime ':all'; | |
use Time::Piece::Plus; | |
use Test::More; | |
use YAPC; | |
subtest 'is_yet()' => sub { | |
subtest 'before' => sub { | |
# before | |
my $before = | |
Time::Piece::Plus->parse_mysql_datetime( | |
str => '2014-08-28 00:00:00', | |
as_localtime => 1 | |
); | |
my $before_epoch = $before->epoch(); | |
set_fixed_time($before_epoch); | |
ok YAPC::is_yet(); | |
}; | |
subtest 'after' => sub { | |
my $after = | |
Time::Piece::Plus->parse_mysql_datetime( | |
str => '2014-08-28 01:00:00', | |
as_localtime => 1 | |
); | |
my $after_epoch = $after->epoch(); | |
set_fixed_time($after_epoch); | |
ok !YAPC::is_yet(); | |
}; | |
restore_time(); | |
}; | |
done_testing(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment