From e768f9dc5f3191d270ecdb2d108b394843ef4405 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 9 Jul 2021 12:30:35 +0100 Subject: [PATCH] Bug 11175: (follow-up) Rename routine get_marc_components For consistency with other marc data accessor methods rename the new 'components' method to 'get_marc_components'. Signed-off-by: Martin Renvoize --- C4/XSLT.pm | 4 ++-- Koha/Biblio.pm | 6 +++--- t/db_dependent/Koha/Biblio.t | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 441a39da21..8bddd02b5d 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -277,12 +277,12 @@ sub XSLTParse4Display { my $biblio = Koha::Biblios->find( $biblionumber ); my $max_results = 300; - if ( $biblio->components($max_results) ) { + if ( $biblio->get_marc_components($max_results) ) { my $search_query = Koha::Util::Search::get_component_part_query($biblionumber); $variables->{ComponentPartQuery} = $search_query; my @componentPartRecordXML = (''); - for my $cb ( @{ $biblio->components($max_results) } ) { + for my $cb ( @{ $biblio->get_marc_components($max_results) } ) { if( ref $cb eq 'MARC::Record'){ $cb = $cb->as_xml_record(); } else { diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 2aa73074fb..d42e85968d 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -498,16 +498,16 @@ sub suggestions { return Koha::Suggestions->_new_from_dbic( $suggestions_rs ); } -=head3 components +=head3 get_marc_components -my $components = $self->components(); + my $components = $self->get_marc_components(); Returns an array of MARCXML data, which are component parts of this object (MARC21 773$w points to this) =cut -sub components { +sub get_marc_components { my ($self, $max_results) = @_; return if (C4::Context->preference('marcflavour') ne 'MARC21'); diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t index 4b749413d4..d974ef8491 100755 --- a/t/db_dependent/Koha/Biblio.t +++ b/t/db_dependent/Koha/Biblio.t @@ -503,7 +503,7 @@ subtest 'suggestions() tests' => sub { $schema->storage->txn_rollback; }; -subtest 'components() tests' => sub { +subtest 'get_marc_components() tests' => sub { plan tests => 3; @@ -515,13 +515,13 @@ subtest 'components() tests' => sub { my $search_mod = Test::MockModule->new( 'Koha::SearchEngine::Zebra::Search' ); $search_mod->mock( 'simple_search_compat', \&search_component_record2 ); - my @components = $host_biblio->components; + my @components = $host_biblio->get_marc_components; is( ref(\@components), 'ARRAY', 'Return type is correct' ); is_deeply( [@components], [()], - '->components returns an empty ARRAY' + '->get_marc_components returns an empty ARRAY' ); $search_mod->unmock( 'simple_search_compat'); @@ -529,9 +529,9 @@ subtest 'components() tests' => sub { my $component_record = component_record1()->as_xml(); is_deeply( - $host_biblio->components, + $host_biblio->get_marc_components, [($component_record)], - '->components returns the related component part record' + '->get_marc_components returns the related component part record' ); $search_mod->unmock( 'simple_search_compat'); -- 2.20.1