From a7bd9e005fec49a8e46852af7d16bcf8640f80d3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 8 Jun 2023 12:46:25 +0200 Subject: [PATCH] Bug 33954: Add tests --- t/db_dependent/Koha/Biblio.t | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t index d0945eb0666..796698446bb 100755 --- a/t/db_dependent/Koha/Biblio.t +++ b/t/db_dependent/Koha/Biblio.t @@ -17,7 +17,7 @@ use Modern::Perl; -use Test::More tests => 26; +use Test::More tests => 27; use Test::Exception; use Test::Warn; @@ -1132,6 +1132,30 @@ subtest 'ratings' => sub { ok(1); }; +subtest 'opac_summary_html' => sub { + + plan tests => 2; + + my $author = 'my author'; + my $title = 'my title'; + my $isbn = '9781250067128 | 125006712X'; + my $biblio = $builder->build_sample_biblio( { author => $author, title => $title } ); + $biblio->biblioitem->set( { isbn => '9781250067128 | 125006712X' } )->store; + + t::lib::Mocks::mock_preference( 'OPACMySummaryHTML', '' ); + is( $biblio->opac_summary_html, '', 'opac_summary_html returns empty string if pref is off' ); + + t::lib::Mocks::mock_preference( + 'OPACMySummaryHTML', + 'Replace {AUTHOR}, {TITLE}, {ISBN} AND {BIBLIONUMBER} please' + ); + is( + $biblio->opac_summary_html, + sprintf( 'Replace %s, %s, %s AND %s please', $author, $title, $biblio->normalized_isbn, $biblio->biblionumber ), + 'opac_summary_html replaces the different patterns' + ); +}; + sub component_record1 { my $marc = MARC::Record->new; $marc->append_fields( -- 2.25.1