From 0e28aad1fed19a675ea120be9847c9cdbb434d62 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 2 Feb 2026 14:12:10 +0100 Subject: [PATCH] Bug 41685: Unit tests Content-Type: text/plain; charset=utf-8 Test plan: Run t/db_dependent/AuthoritiesMarc.t Signed-off-by: Marcel de Rooy --- t/db_dependent/AuthoritiesMarc.t | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/AuthoritiesMarc.t b/t/db_dependent/AuthoritiesMarc.t index e223ddba34..681f428e0b 100755 --- a/t/db_dependent/AuthoritiesMarc.t +++ b/t/db_dependent/AuthoritiesMarc.t @@ -6,7 +6,7 @@ use Modern::Perl; use Test::NoWarnings; -use Test::More tests => 14; +use Test::More tests => 15; use Test::MockModule; use Test::Warn; use MARC::Field; @@ -398,3 +398,22 @@ subtest 'DelAuthority() tests' => sub { $schema->storage->txn_rollback; }; + +subtest 'BuildSummary/_marc21_sort_hierarchy_alpha' => sub { + plan tests => 1; + #$schema->storage->txn_begin; + #t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); + + my @fields; + push @fields, MARC::Field->new( '550', '', '', a => 'zzz', w => 'h' ); + push @fields, MARC::Field->new( '550', '', '', a => 'yyy', w => 'g' ); + push @fields, MARC::Field->new( '550', '', '', a => 'xxx', w => 'x' ); + push @fields, MARC::Field->new( '550', '', '', a => 'www', w => '' ); + push @fields, MARC::Field->new( '550', '', '', a => 'vvv', w => 'g' ); + push @fields, MARC::Field->new( '550', '', '', a => 'uuu', w => 'h' ); + + my @sorted_sub_a = map { $_->subfield('a') } C4::AuthoritiesMarc::_marc21_sort_hierarchy_alpha(@fields); + is_deeply( \@sorted_sub_a, [ 'vvv', 'yyy', 'www', 'xxx', 'uuu', 'zzz' ], 'Sorted as expected' ); + + #$schema->storage->txn_rollback; +}; -- 2.39.5