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

(-)a/t/db_dependent/OAI/Server.t (-2 / +57 lines)
Lines 21-27 use Modern::Perl; Link Here
21
use Test::Deep qw( cmp_deeply re );
21
use Test::Deep qw( cmp_deeply re );
22
use Test::MockTime qw/set_fixed_time restore_time/;
22
use Test::MockTime qw/set_fixed_time restore_time/;
23
23
24
use Test::More tests => 31;
24
use Test::More tests => 32;
25
use DateTime;
25
use DateTime;
26
use File::Basename;
26
use File::Basename;
27
use File::Spec;
27
use File::Spec;
Lines 34-39 use t::lib::Mocks; Link Here
34
34
35
use C4::Biblio qw( AddBiblio GetMarcBiblio ModBiblio );
35
use C4::Biblio qw( AddBiblio GetMarcBiblio ModBiblio );
36
use C4::Context;
36
use C4::Context;
37
use C4::OAI::Sets qw(AddOAISet);
37
38
38
use Koha::Biblio::Metadatas;
39
use Koha::Biblio::Metadatas;
39
use Koha::Database;
40
use Koha::Database;
Lines 430-432 subtest 'Bug 20665: OAI-PMH Provider should reset the MySQL connection time zone Link Here
430
431
431
432
432
$schema->storage->txn_rollback;
433
$schema->storage->txn_rollback;
433
- 
434
435
subtest 'ListSets tests' => sub {
436
437
    plan tests => 2;
438
439
    t::lib::Mocks::mock_preference( 'OAI::PMH'         => 1 );
440
    t::lib::Mocks::mock_preference( 'OAI-PMH:MaxCount' => 3 );
441
442
    $schema->storage->txn_begin;
443
444
    $dbh->do('DELETE FROM oai_sets');
445
446
    # Add a bunch of sets
447
    my @sets = ();
448
    for my $i ( 1 .. 3 ) {
449
450
        AddOAISet(
451
            {   'spec' => "setSpec_$i",
452
                'name' => "setName_$i",
453
            }
454
        );
455
        push @sets, { setSpec => "setSpec_$i", setName => "setName_$i" };
456
    }
457
458
    # Add one more to force pagination
459
    AddOAISet(
460
        {   'spec' => "setSpec_4",
461
            'name' => "setName_4",
462
        }
463
    );
464
465
    test_query(
466
        'ListSets',
467
        { verb => 'ListSets' },
468
        { ListSets => {
469
            resumptionToken => {
470
                content => re( qr{^/3////1/0/3$} ),
471
                cursor => 3,
472
            },
473
            set => \@sets
474
          }
475
        }
476
    );
477
478
    test_query(
479
        'ListSets',
480
        { verb => 'ListSets', resumptionToken => "/9/1970-01-01T00:00:00Z///0/0/3" },
481
        { ListSets => {
482
            set => { setSpec => "setSpec_4", setName => "setName_4" }
483
          }
484
        }
485
    );
486
487
    $schema->storage->txn_rollback;
488
};

Return to bug 28741