Bugzilla – Attachment 152507 Details for
Bug 31185
Link authorities automatically doesn't detect duplicate authorities
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31185: Unit test
Bug-31185-Unit-test.patch (text/plain), 2.92 KB, created by
Martin Renvoize (ashimema)
on 2023-06-21 09:50:22 UTC
(
hide
)
Description:
Bug 31185: Unit test
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-06-21 09:50:22 UTC
Size:
2.92 KB
patch
obsolete
>From d1301c6e3dcd3bf36dbae3703ad8a95814123432 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 3 May 2023 17:20:51 +0000 >Subject: [PATCH] Bug 31185: Unit test > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Biblio.t | 56 ++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 55 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t >index 1edf349e65..8cf358d412 100755 >--- a/t/db_dependent/Biblio.t >+++ b/t/db_dependent/Biblio.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 18; >+use Test::More tests => 19; > use Test::MockModule; > use Test::Warn; > use List::MoreUtils qw( uniq ); >@@ -781,6 +781,60 @@ subtest 'ModBiblio called from linker test' => sub { > is($called,0,"We didn't call to link bibs because from linker"); > }; > >+subtest "LinkBibHeadingsToAuthorities tests" => sub { >+ plan tests => 5; >+ >+ # Set up mocks to return more than 1 match >+ my $biblio_mod = Test::MockModule->new( 'C4::Linker::Default' ); >+ $biblio_mod->mock( 'get_link', sub { >+ return (undef, undef, 2); >+ }); >+ # UNIMARC return values should be consistent with MARC21 >+ # testing with MARC21 should be sufficient for now >+ t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); >+ t::lib::Mocks::mock_preference('AutoCreateAuthorities', '0'); >+ >+ my $linker = C4::Linker::Default->new(); >+ my $biblio = $builder->build_sample_biblio(); >+ my $record = $biblio->metadata->record; >+ >+ # Generate a field, no current link >+ my $field = MARC::Field->new('650','','','a' => 'Duplicated' ); >+ >+ $record->append_fields($field); >+ my ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities( $linker, $record, "", undef, 650, 1 ); >+ is( $num_headings_changed, 0, 'We did not make any changes because we found 2' ); >+ is_deeply( $results->{unlinked}, >+ {"Duplicated" => 1 }, >+ "The heading was not linked" >+ ); >+ is_deeply( $results->{details}[0], >+ { >+ tag => 650, >+ authid => undef, >+ status => 'MULTIPLE_MATCH', >+ auth_type => 'TOPIC_TERM', >+ tag_to_report => 150 >+ }, >+ "The heading was not linked" >+ ); >+ >+ t::lib::Mocks::mock_preference('AutoCreateAuthorities', '1'); >+ ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities( $linker, $record, "", undef, 650, 1 ); >+ is( $num_headings_changed, 0, 'We did not make any changes because we found 2' ); >+ is_deeply( $results->{details}[0], >+ { >+ tag => 650, >+ authid => undef, >+ status => 'MULTIPLE_MATCH', >+ auth_type => 'TOPIC_TERM', >+ tag_to_report => 150 >+ }, >+ "When AutoCreateAuthorities is enabled, multiple results are reported" >+ ); >+ >+}; >+ > subtest "LinkBibHeadingsToAuthorities record generation tests" => sub { > plan tests => 12; > >-- >2.41.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31185
:
137860
|
138518
|
139857
|
150610
|
150762
| 152507 |
152508