]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/perlmods/live_t/11-lp1481036-future-backdate.t
LP2042879 Shelving Location Groups Admin accessibility
[Evergreen.git] / Open-ILS / src / perlmods / live_t / 11-lp1481036-future-backdate.t
1 #!perl
2 use strict; use warnings;
3
4 use Test::More tests => 3;
5
6 diag("Tests handling of future backdates in checkin");
7
8 use constant ITEM_BARCODE => 'CONC4000070';
9
10 use DateTime;
11 use OpenILS::Utils::TestUtils;
12 my $script = OpenILS::Utils::TestUtils->new();
13 $script->bootstrap;
14
15 $script->authenticate({
16     username => 'admin',
17     password => 'demo123',
18     type => 'staff'
19 });
20
21 ok($script->authtoken, 'Have an authtoken');
22
23 my $checkin_resp = $script->do_checkin({
24     barcode => ITEM_BARCODE,
25     backdate => '3001-01-23' # date of the singularity; it is known.
26 });
27
28 is(ref $checkin_resp,'HASH','Checkin request returned a HASH');
29
30 my $ymd = DateTime->now->set_time_zone(DateTime::TimeZone->new( name => "local" ))->strftime('%F');
31
32 ok(
33     substr($checkin_resp->{payload}->{circ}->checkin_time, 0, 10) eq $ymd,
34     'Checkin time matches current date, not backdate'
35 );
36