Bugzilla – Attachment 179934 Details for
Bug 38729
Linker should consider diacritics
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38729: Unit tests
Bug-38729-Unit-tests.patch (text/plain), 3.62 KB, created by
Janusz Kaczmarek
on 2025-03-31 09:19:57 UTC
(
hide
)
Description:
Bug 38729: Unit tests
Filename:
MIME Type:
Creator:
Janusz Kaczmarek
Created:
2025-03-31 09:19:57 UTC
Size:
3.62 KB
patch
obsolete
>From 9bd8c7f3fce32639d4200f95f1ba1143fdbaf8b6 Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Tue, 17 Dec 2024 13:31:39 +0000 >Subject: [PATCH] Bug 38729: Unit tests > >Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> >--- > t/db_dependent/Heading.t | 79 +++++++++++++++++++++++++++++++++++++++- > 1 file changed, 78 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Heading.t b/t/db_dependent/Heading.t >index 1356bca8a0..9e0cd90e3b 100755 >--- a/t/db_dependent/Heading.t >+++ b/t/db_dependent/Heading.t >@@ -19,11 +19,18 @@ use strict; > use warnings; > > use Test::NoWarnings; >-use Test::More tests => 5; >+use Test::More tests => 6; >+ >+use open qw/ :std :utf8 /; > > use t::lib::Mocks; > use Test::MockModule; > >+use MARC::Record; >+use MARC::Field; >+use utf8; >+use C4::AuthoritiesMarc qw/ AddAuthority /; >+ > BEGIN { > use_ok( 'C4::Heading', qw( field valid_heading_subfield ) ); > } >@@ -220,3 +227,73 @@ subtest "_search tests" => sub { > ); > > }; >+ >+subtest "authorities exact match tests" => sub { >+ >+ plan tests => 3; >+ >+ t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' ); >+ >+ my $schema = Koha::Database->new->schema; >+ $schema->storage->txn_begin; >+ >+ my $authrec1 = MARC::Record->new; >+ $authrec1->leader(' nz a22 o 4500'); >+ $authrec1->insert_fields_ordered( MARC::Field->new( '100', '1', ' ', a => 'Rakowski, Albin', x => 'poetry' ) ); >+ my $authid1 = AddAuthority( $authrec1, undef, 'PERSO_NAME', { skip_record_index => 1 } ); >+ >+ my $authrec2 = MARC::Record->new; >+ $authrec2->leader(' nz a22 o 4500'); >+ $authrec2->insert_fields_ordered( MARC::Field->new( '100', '1', ' ', a => 'RÄkowski, Albin', x => 'poetry' ) ); >+ my $authid2 = AddAuthority( $authrec2, undef, 'PERSO_NAME', { skip_record_index => 1 } ); >+ >+ my $heading = Test::MockModule->new('C4::Heading'); >+ $heading->mock( >+ '_search', >+ sub { >+ my $self = shift; >+ return ( [ { authid => $authid1 }, { authid => $authid2 } ], 2 ); >+ } >+ ); >+ >+ my $biblio_field = MARC::Field->new( '600', '1', '1', a => 'Rakowski, Albin', x => 'poetry' ); >+ my $biblio_heading = C4::Heading->new_from_field($biblio_field); >+ >+ t::lib::Mocks::mock_preference( 'LinkerConsiderDiacritics', '0' ); >+ >+ my $authorities = $biblio_heading->authorities(1); >+ is_deeply( >+ $authorities, [ { authid => $authid1 }, { authid => $authid2 } ], >+ "Authorities diacritics filter off - two authids returned for authority search 'Rakowski' from biblio 600 field 'Rakowski'" >+ ); >+ >+ t::lib::Mocks::mock_preference( 'LinkerConsiderDiacritics', '1' ); >+ >+ $authorities = $biblio_heading->authorities(1); >+ is_deeply( >+ $authorities, [ { authid => $authid1 } ], >+ "Authorities filter OK - remained authority 'Rakowski' for biblio 'Rakowski'" >+ ); >+ >+ my $authrec3 = MARC::Record->new; >+ $authrec3->leader(' nz a22 o 4500'); >+ $authrec3->insert_fields_ordered( MARC::Field->new( '100', '1', ' ', a => 'Bruckner, Karl' ) ); >+ my $authid3 = AddAuthority( $authrec3, undef, 'PERSO_NAME', { skip_record_index => 1 } ); >+ >+ $heading->mock( >+ '_search', >+ sub { >+ my $self = shift; >+ return ( [ { authid => $authid3 } ], 1 ); >+ } >+ ); >+ >+ $biblio_field = MARC::Field->new( '700', '1', ' ', a => 'Brückner, Karl' ); >+ $biblio_heading = C4::Heading->new_from_field($biblio_field); >+ >+ $authorities = $biblio_heading->authorities(1); >+ is_deeply( $authorities, [], "Authorities filter OK - 'Brückner' not matched with 'Bruckner'" ); >+ >+ $schema->storage->txn_rollback; >+ >+}; >-- >2.39.5
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 38729
:
175626
|
175627
|
175640
|
175644
|
175645
|
179929
|
179930
|
179931
|
179932
|
179933
|
179934
|
180007
|
180008
|
180009