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

(-)a/C4/Linker/Default.pm (+1 lines)
Lines 92-97 sub update_cache { Link Here
92
    my $search_form = $heading->search_form();
92
    my $search_form = $heading->search_form();
93
    my $auth_type = $heading->auth_type();
93
    my $auth_type = $heading->auth_type();
94
    my $thesaurus   = $heading->{thesaurus} || 'notdefined';
94
    my $thesaurus   = $heading->{thesaurus} || 'notdefined';
95
    $thesaurus = 'notconsidered' unless C4::Context->preference('LinkerConsiderThesaurus');
95
    my $fuzzy = 0;
96
    my $fuzzy = 0;
96
97
97
    $self->{'cache'}->{$search_form.$auth_type.$thesaurus}->{'cached'} = 1;
98
    $self->{'cache'}->{$search_form.$auth_type.$thesaurus}->{'cached'} = 1;
(-)a/t/db_dependent/Linker_Default.t (-2 / +8 lines)
Lines 42-48 my $schema = $builder->schema(); Link Here
42
$schema->storage->txn_begin;
42
$schema->storage->txn_begin;
43
43
44
subtest 'Test caching in get_link and update_cache' => sub {
44
subtest 'Test caching in get_link and update_cache' => sub {
45
    plan tests => 16;
45
    plan tests => 18;
46
46
47
    my @tags = C4::Context->preference('marcflavour') eq 'UNIMARC' ? (601,'j',602,'a') : (650,'a',655,'a');
47
    my @tags = C4::Context->preference('marcflavour') eq 'UNIMARC' ? (601,'j',602,'a') : (650,'a',655,'a');
48
48
Lines 120-125 subtest 'Test caching in get_link and update_cache' => sub { Link Here
120
    is( $authid, 4, "Correct id for sao term is retrieved from the cache" );
120
    is( $authid, 4, "Correct id for sao term is retrieved from the cache" );
121
    $linker->update_cache($subject_heading4,78);
121
    $linker->update_cache($subject_heading4,78);
122
    is( $linker->{cache}->{$subject_heading4->search_form.$subject_heading4->auth_type.$subject_heading4->{'thesaurus'}}->{authid}, 78, "Linker cache for the bnb record is correctly updated by 'update_cache'");
122
    is( $linker->{cache}->{$subject_heading4->search_form.$subject_heading4->auth_type.$subject_heading4->{'thesaurus'}}->{authid}, 78, "Linker cache for the bnb record is correctly updated by 'update_cache'");
123
124
    t::lib::Mocks::mock_preference('LinkerConsiderThesaurus',0);
125
    $linker->update_cache($subject_heading,32);
126
    is( $linker->{cache}->{$subject_heading->search_form.$subject_heading->auth_type.'notconsidered'}->{authid}, 32, "Linker cache is correctly updated by 'update_cache'");
127
    ( $authid, undef ) = $linker->get_link($subject_heading);
128
    is( $authid, 32, "Correct id is retrieved from the cache" );
129
123
};
130
};
124
131
125
$schema->storage->txn_rollback;
132
$schema->storage->txn_rollback;
126
- 

Return to bug 35125