Lines 21-26
use Modern::Perl;
Link Here
|
21 |
|
21 |
|
22 |
use Test::More tests => 29; |
22 |
use Test::More tests => 29; |
23 |
use DateTime; |
23 |
use DateTime; |
|
|
24 |
use Time::Fake; |
24 |
use Test::MockModule; |
25 |
use Test::MockModule; |
25 |
use Test::Warn; |
26 |
use Test::Warn; |
26 |
use XML::Simple; |
27 |
use XML::Simple; |
Lines 57-62
my %param;
Link Here
|
57 |
my $module = Test::MockModule->new('CGI'); |
58 |
my $module = Test::MockModule->new('CGI'); |
58 |
$module->mock('Vars', sub { %param; }); |
59 |
$module->mock('Vars', sub { %param; }); |
59 |
|
60 |
|
|
|
61 |
|
62 |
Time::Fake->offset( dt_from_string->epoch ); |
63 |
|
60 |
my $schema = Koha::Database->schema; |
64 |
my $schema = Koha::Database->schema; |
61 |
$schema->storage->txn_begin; |
65 |
$schema->storage->txn_begin; |
62 |
my $dbh = C4::Context->dbh; |
66 |
my $dbh = C4::Context->dbh; |
Lines 72-78
$dbh->do('DELETE FROM oai_sets');
Link Here
|
72 |
my $date_added = DateTime->now() . 'Z'; |
76 |
my $date_added = DateTime->now() . 'Z'; |
73 |
my $date_to = substr($date_added, 0, 10) . 'T23:59:59Z'; |
77 |
my $date_to = substr($date_added, 0, 10) . 'T23:59:59Z'; |
74 |
my (@header, @marcxml, @oaidc); |
78 |
my (@header, @marcxml, @oaidc); |
75 |
my $sth = $dbh->prepare('SELECT timestamp FROM biblioitems WHERE biblionumber=?'); |
|
|
76 |
|
79 |
|
77 |
# Add biblio records |
80 |
# Add biblio records |
78 |
foreach my $index ( 0 .. NUMBER_OF_MARC_RECORDS - 1 ) { |
81 |
foreach my $index ( 0 .. NUMBER_OF_MARC_RECORDS - 1 ) { |
Lines 85-96
foreach my $index ( 0 .. NUMBER_OF_MARC_RECORDS - 1 ) {
Link Here
|
85 |
$record->append_fields( MARC::Field->new('245', '', '', 'a' => "Title $index" ) ); |
88 |
$record->append_fields( MARC::Field->new('245', '', '', 'a' => "Title $index" ) ); |
86 |
} |
89 |
} |
87 |
my ($biblionumber) = AddBiblio($record, ''); |
90 |
my ($biblionumber) = AddBiblio($record, ''); |
88 |
$sth->execute($biblionumber); |
|
|
89 |
my $timestamp = $sth->fetchrow_array . 'Z'; |
90 |
$timestamp =~ s/ /T/; |
91 |
$record = GetMarcBiblio({ biblionumber => $biblionumber }); |
91 |
$record = GetMarcBiblio({ biblionumber => $biblionumber }); |
92 |
$record = XMLin($record->as_xml_record); |
92 |
$record = XMLin($record->as_xml_record); |
93 |
push @header, { datestamp => $timestamp, identifier => "TEST:$biblionumber" }; |
93 |
push @header, { datestamp => $date_added, identifier => "TEST:$biblionumber" }; |
94 |
my $dc = { |
94 |
my $dc = { |
95 |
'dc:title' => "Title $index", |
95 |
'dc:title' => "Title $index", |
96 |
'dc:language' => "lng", |
96 |
'dc:language' => "lng", |
97 |
- |
|
|