From fa5f9470c9e9f09ecf51ea141390f8175b1923d1 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 24 Jul 2023 14:00:48 +0000 Subject: [PATCH] Bug 34357: Replace SUPER->imageurl in ItemTypes Test plan: Run t/db_dependent/Koha/ItemTypes.t Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- Koha/ItemType.pm | 2 +- t/db_dependent/Koha/ItemTypes.t | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Koha/ItemType.pm b/Koha/ItemType.pm index dbbae3fbfc..18f2544604 100644 --- a/Koha/ItemType.pm +++ b/Koha/ItemType.pm @@ -86,7 +86,7 @@ sub delete { sub image_location { my ( $self, $interface ) = @_; - return C4::Koha::getitemtypeimagelocation( $interface, $self->SUPER::imageurl ); + return C4::Koha::getitemtypeimagelocation( $interface, $self->imageurl ); } =head3 translated_description diff --git a/t/db_dependent/Koha/ItemTypes.t b/t/db_dependent/Koha/ItemTypes.t index aecd8d971b..d62cf05e48 100755 --- a/t/db_dependent/Koha/ItemTypes.t +++ b/t/db_dependent/Koha/ItemTypes.t @@ -19,8 +19,7 @@ use Modern::Perl; -use Data::Dumper; -use Test::More tests => 14; +use Test::More tests => 15; use t::lib::Mocks; use t::lib::TestBuilder; @@ -134,4 +133,21 @@ $biblio->delete; is ( $item_type->can_be_deleted, 1, 'The item type that was being used by the removed item and biblioitem can now be deleted' ); +subtest 'image_location' => sub { + plan tests => 3; + + my $item_type = $builder->build_object( { class => 'Koha::ItemTypes' } ); + $item_type->imageurl('https://myserver.org/image01'); + is( $item_type->image_location, 'https://myserver.org/image01', 'Check URL' ); + $item_type->imageurl('bridge/newthing.png'); + is( + $item_type->image_location('opac'), '/opac-tmpl/bootstrap/itemtypeimg/bridge/newthing.png', + 'Check path for opac' + ); + is( + $item_type->image_location('intranet'), '/intranet-tmpl/prog/img/itemtypeimg/bridge/newthing.png', + 'Check path for intranet' + ); +}; + $schema->txn_rollback; -- 2.39.5