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

(-)a/t/db_dependent/OAI/Sets.t (-2 / +52 lines)
Lines 18-24 Link Here
18
18
19
use Modern::Perl;
19
use Modern::Perl;
20
20
21
use Test::More tests => 152;
21
use Test::More tests => 158;
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 560-565 is($oai_setsVH->[0]->{id}, $setVH_id, 'id is ok'); Link Here
560
is($oai_setsVH->[0]->{spec}, $setVH->{spec}, 'id is ok');
560
is($oai_setsVH->[0]->{spec}, $setVH->{spec}, 'id is ok');
561
is($oai_setsVH->[0]->{name}, $setVH->{name}, 'id is ok');
561
is($oai_setsVH->[0]->{name}, $setVH->{name}, 'id is ok');
562
562
563
# Bug 25460 - Embed item data in biblio MARC when OAI-PMH:AutoUpdateSetsEmbedItemData syspref is enabled
564
#test
565
t::lib::Mocks::mock_preference( 'OAI-PMH:AutoUpdateSetsEmbedItemData', 0 );
566
567
#Create a set
568
my $setFIC = {
569
    'spec' => 'Set where collection code is FIC',
570
    'name' => 'FIC'
571
};
572
my $setFIC_id = AddOAISet($setFIC);
573
574
#Create mappings : 'ccode' should be 'FIC'
575
my $mappingsFIC;
576
$mappingsFIC = [
577
    {
578
       marcfield => '952',
579
       marcsubfield => '8',
580
       operator => 'equal',
581
       marcvalue => 'FIC'
582
   }
583
];
584
ModOAISetMappings($setFIC_id, $mappingsFIC);
585
586
# Create biblio with 'FIC' item
587
my $biblio_FIC = $builder->build_sample_biblio();
588
my $item = $builder->build_sample_item(
589
    {
590
        biblionumber     => $biblio_FIC->biblionumber,
591
        ccode            => 'FIC'
592
    }
593
);
594
595
#Update
596
my $recordFIC = GetMarcBiblio({ biblionumber => $biblio_FIC->biblionumber });
597
UpdateOAISetsBiblio($biblio_FIC->biblionumber, $recordFIC);
598
599
#is biblio attached to setFIC ?
600
my $oai_setsFIC = GetOAISetsBiblio($biblio_FIC->biblionumber);
601
is($oai_setsFIC->[0]->{id}, undef, 'id is ok');
602
is($oai_setsFIC->[0]->{spec}, undef, 'id is ok');
603
is($oai_setsFIC->[0]->{name}, undef, 'id is ok');
604
605
t::lib::Mocks::mock_preference( 'OAI-PMH:AutoUpdateSetsEmbedItemData', 1 );
606
UpdateOAISetsBiblio($biblio_FIC->biblionumber, $recordFIC);
607
608
#is biblio attached to setFIC ?
609
$oai_setsFIC = GetOAISetsBiblio($biblio_FIC->biblionumber);
610
is($oai_setsFIC->[0]->{id}, $setFIC_id, 'id is ok');
611
is($oai_setsFIC->[0]->{spec}, $setFIC->{spec}, 'id is ok');
612
is($oai_setsFIC->[0]->{name}, $setFIC->{name}, 'id is ok');
613
563
614
564
# ---------- Testing CalcOAISetsBiblio ----------
615
# ---------- Testing CalcOAISetsBiblio ----------
565
ok (!defined(CalcOAISetsBiblio), 'CalcOAISetsBiblio without argument is undef');
616
ok (!defined(CalcOAISetsBiblio), 'CalcOAISetsBiblio without argument is undef');
566
- 

Return to bug 25460