|
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 => 3; |
| 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 @first_page_sets = (); |
| 448 |
for my $i ( 1 .. 3 ) { |
| 449 |
|
| 450 |
AddOAISet( |
| 451 |
{ 'spec' => "setSpec_$i", |
| 452 |
'name' => "setName_$i", |
| 453 |
} |
| 454 |
); |
| 455 |
push @first_page_sets, { setSpec => "setSpec_$i", setName => "setName_$i" }; |
| 456 |
} |
| 457 |
|
| 458 |
# Add more to force pagination |
| 459 |
my @second_page_sets = (); |
| 460 |
for my $i ( 4 .. 6 ) { |
| 461 |
|
| 462 |
AddOAISet( |
| 463 |
{ 'spec' => "setSpec_$i", |
| 464 |
'name' => "setName_$i", |
| 465 |
} |
| 466 |
); |
| 467 |
push @second_page_sets, { setSpec => "setSpec_$i", setName => "setName_$i" }; |
| 468 |
} |
| 469 |
|
| 470 |
AddOAISet( |
| 471 |
{ 'spec' => "setSpec_7", |
| 472 |
'name' => "setName_7", |
| 473 |
} |
| 474 |
); |
| 475 |
|
| 476 |
test_query( |
| 477 |
'ListSets', |
| 478 |
{ verb => 'ListSets' }, |
| 479 |
{ ListSets => { |
| 480 |
resumptionToken => { |
| 481 |
content => re( qr{^/3////1/0/4$} ), |
| 482 |
cursor => 3, |
| 483 |
}, |
| 484 |
set => \@first_page_sets |
| 485 |
} |
| 486 |
} |
| 487 |
); |
| 488 |
|
| 489 |
test_query( |
| 490 |
'ListSets', |
| 491 |
{ verb => 'ListSets', resumptionToken => '/3////1/0/4' }, |
| 492 |
{ ListSets => { |
| 493 |
resumptionToken => { |
| 494 |
content => re( qr{^/6////1/0/7$} ), |
| 495 |
cursor => 6, |
| 496 |
}, |
| 497 |
set => \@second_page_sets |
| 498 |
} |
| 499 |
} |
| 500 |
); |
| 501 |
|
| 502 |
test_query( |
| 503 |
'ListSets', |
| 504 |
{ verb => 'ListSets', resumptionToken => "/6////1/0/7" }, |
| 505 |
{ ListSets => { |
| 506 |
set => { setSpec => "setSpec_7", setName => "setName_7" } |
| 507 |
} |
| 508 |
} |
| 509 |
); |
| 510 |
|
| 511 |
$schema->storage->txn_rollback; |
| 512 |
}; |