View | Details | Raw Unified | Return to bug 15108
Collapse All | Expand All

(-)a/t/db_dependent/OAI/Server.t (-4 / +17 lines)
Lines 47-52 BEGIN { Link Here
47
    use_ok('Koha::OAI::Server::ResumptionToken');
47
    use_ok('Koha::OAI::Server::ResumptionToken');
48
}
48
}
49
49
50
use constant NUMBER_OF_MARC_RECORDS => 10;
51
50
# Mocked CGI module in order to be able to send CGI parameters to OAI Server
52
# Mocked CGI module in order to be able to send CGI parameters to OAI Server
51
my %param;
53
my %param;
52
my $module = Test::MockModule->new('CGI');
54
my $module = Test::MockModule->new('CGI');
Lines 67-80 my $date_to = substr($date_added, 0, 10) . 'T23:59:59Z'; Link Here
67
my (@header, @marcxml, @oaidc);
69
my (@header, @marcxml, @oaidc);
68
my $sth = $dbh->prepare('SELECT timestamp FROM biblioitems WHERE biblionumber=?');
70
my $sth = $dbh->prepare('SELECT timestamp FROM biblioitems WHERE biblionumber=?');
69
71
70
# Add 10 biblio records
72
# Add biblio records
71
foreach my $index ( 0..9 ) {
73
foreach my $index ( 0 .. NUMBER_OF_MARC_RECORDS - 1 ) {
72
    my $record = MARC::Record->new();
74
    my $record = MARC::Record->new();
73
    $record->append_fields( MARC::Field->new('245', '', '', 'a' => "Title $index" ) );
75
    $record->append_fields( MARC::Field->new('245', '', '', 'a' => "Title $index" ) );
74
    my ($biblionumber) = AddBiblio($record, '');
76
    my ($biblionumber) = AddBiblio($record, '');
75
    $sth->execute($biblionumber);
77
    $sth->execute($biblionumber);
76
    my $timestamp = $sth->fetchrow_array . 'Z';
78
    my $timestamp = $sth->fetchrow_array . 'Z';
77
    $timestamp =~ s/ /T/;
79
    $timestamp =~ s/ /T/;
80
    $timestamp = manipulate_timestamp( $index, $biblionumber, $timestamp );
78
    $record = GetMarcBiblio($biblionumber);
81
    $record = GetMarcBiblio($biblionumber);
79
    $record = XMLin($record->as_xml_record);
82
    $record = XMLin($record->as_xml_record);
80
    push @header, { datestamp => $timestamp, identifier => "TEST:$biblionumber" };
83
    push @header, { datestamp => $timestamp, identifier => "TEST:$biblionumber" };
Lines 112-118 foreach my $index ( 0..9 ) { Link Here
112
            },
115
            },
113
        },
116
        },
114
    };
117
    };
115
    sleep 2; # FIXME Why do we need this sleep?
116
}
118
}
117
119
118
my $syspref = {
120
my $syspref = {
Lines 343-345 test_query( Link Here
343
});
345
});
344
346
345
$schema->storage->txn_rollback;
347
$schema->storage->txn_rollback;
346
- 
348
349
sub manipulate_timestamp {
350
# This eliminates waiting a few seconds in order to get a higher timestamp
351
# Works only for 60 records..
352
    my ( $index, $bibno, $timestamp ) = @_;
353
    return $timestamp if $timestamp !~ /\d{2}Z/;
354
    my $secs = sprintf( "%02d", $index );
355
    $timestamp =~ s/\d{2}Z/${secs}Z/;
356
    $dbh->do("UPDATE biblioitems SET timestamp=? WHERE biblionumber=?", undef,
357
        ( $timestamp, $bibno ));
358
    return $timestamp;
359
}

Return to bug 15108