Lines 18-24
Link Here
|
18 |
|
18 |
|
19 |
use Modern::Perl; |
19 |
use Modern::Perl; |
20 |
|
20 |
|
21 |
use Test::More tests => 147; |
21 |
use Test::More tests => 153; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
use MARC::Record; |
24 |
use MARC::Record; |
Lines 28-33
use C4::Biblio;
Link Here
|
28 |
use C4::OAI::Sets; |
28 |
use C4::OAI::Sets; |
29 |
|
29 |
|
30 |
use t::lib::TestBuilder; |
30 |
use t::lib::TestBuilder; |
|
|
31 |
use t::lib::Mocks; |
31 |
|
32 |
|
32 |
my $schema = Koha::Database->new->schema; |
33 |
my $schema = Koha::Database->new->schema; |
33 |
$schema->storage->txn_begin; |
34 |
$schema->storage->txn_begin; |
Lines 534-539
is($oai_setsVH->[0]->{id}, $setVH_id, 'id is ok');
Link Here
|
534 |
is($oai_setsVH->[0]->{spec}, $setVH->{spec}, 'id is ok'); |
535 |
is($oai_setsVH->[0]->{spec}, $setVH->{spec}, 'id is ok'); |
535 |
is($oai_setsVH->[0]->{name}, $setVH->{name}, 'id is ok'); |
536 |
is($oai_setsVH->[0]->{name}, $setVH->{name}, 'id is ok'); |
536 |
|
537 |
|
|
|
538 |
# Bug 25460 - Embed item data in biblio MARC when OAI-PMH:AutoUpdateSetsEmbedItemData syspref is enabled |
539 |
#test |
540 |
t::lib::Mocks::mock_preference( 'OAI-PMH:AutoUpdateSetsEmbedItemData', 0 ); |
541 |
|
542 |
#Create a set |
543 |
my $setFIC = { |
544 |
'spec' => 'Set where collection code is FIC', |
545 |
'name' => 'FIC' |
546 |
}; |
547 |
my $setFIC_id = AddOAISet($setFIC); |
548 |
|
549 |
#Create mappings : 'ccode' should be 'FIC' |
550 |
my $mappingsFIC; |
551 |
$mappingsFIC = [ |
552 |
{ |
553 |
marcfield => '952', |
554 |
marcsubfield => '8', |
555 |
operator => 'equal', |
556 |
marcvalue => 'FIC' |
557 |
} |
558 |
]; |
559 |
ModOAISetMappings($setFIC_id, $mappingsFIC); |
560 |
|
561 |
# Create biblio with 'FIC' item |
562 |
my $biblio_FIC = $builder->build_sample_biblio(); |
563 |
my $item = $builder->build_sample_item( |
564 |
{ |
565 |
biblionumber => $biblio_FIC->biblionumber, |
566 |
ccode => 'FIC' |
567 |
} |
568 |
); |
569 |
|
570 |
#Update |
571 |
my $recordFIC = GetMarcBiblio({ biblionumber => $biblio_FIC->biblionumber }); |
572 |
UpdateOAISetsBiblio($biblio_FIC->biblionumber, $recordFIC); |
573 |
|
574 |
#is biblio attached to setFIC ? |
575 |
my $oai_setsFIC = GetOAISetsBiblio($biblio_FIC->biblionumber); |
576 |
is($oai_setsFIC->[0]->{id}, undef, 'id is ok'); |
577 |
is($oai_setsFIC->[0]->{spec}, undef, 'id is ok'); |
578 |
is($oai_setsFIC->[0]->{name}, undef, 'id is ok'); |
579 |
|
580 |
t::lib::Mocks::mock_preference( 'OAI-PMH:AutoUpdateSetsEmbedItemData', 1 ); |
581 |
UpdateOAISetsBiblio($biblio_FIC->biblionumber, $recordFIC); |
582 |
|
583 |
#is biblio attached to setFIC ? |
584 |
$oai_setsFIC = GetOAISetsBiblio($biblio_FIC->biblionumber); |
585 |
is($oai_setsFIC->[0]->{id}, $setFIC_id, 'id is ok'); |
586 |
is($oai_setsFIC->[0]->{spec}, $setFIC->{spec}, 'id is ok'); |
587 |
is($oai_setsFIC->[0]->{name}, $setFIC->{name}, 'id is ok'); |
588 |
|
537 |
|
589 |
|
538 |
# ---------- Testing CalcOAISetsBiblio ---------- |
590 |
# ---------- Testing CalcOAISetsBiblio ---------- |
539 |
ok (!defined(CalcOAISetsBiblio), 'CalcOAISetsBiblio without argument is undef'); |
591 |
ok (!defined(CalcOAISetsBiblio), 'CalcOAISetsBiblio without argument is undef'); |
540 |
- |
|
|