Bug 22445: Add tests for Koha::Biblio->custom_cover_image_url
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 22 Oct 2019 13:56:25 +0000 (14:56 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 22 Oct 2019 14:02:48 +0000 (15:02 +0100)
Sponsored-by: Orex Digital
Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
t/db_dependent/Koha/Biblios.t

index a3892c5..0976522 100644 (file)
@@ -19,7 +19,7 @@
 
 use Modern::Perl;
 
-use Test::More tests => 5;
+use Test::More tests => 6;
 use Test::Exception;
 
 use C4::Items;
@@ -186,4 +186,19 @@ subtest 'can_be_transferred' => sub {
         .' is not possible.');
 };
 
+subtest 'custom_cover_image_url' => sub {
+    plan tests => 1;
+    t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/%isbn%_%issn%.png' );
+    my $isbn       = 'my_isbn';
+    my $issn       = 'my_issn';
+    my $biblioitem = $builder->build_object(
+        {
+            class => 'Koha::Biblioitems',
+            value => { isbn => $isbn, issn => $issn }
+        }
+    );
+    my $biblio = Koha::Biblios->find( $biblioitem->biblionumber );
+    is( $biblio->custom_cover_image_url, "https://my_url/${isbn}_${issn}.png" );
+};
+
 $schema->storage->txn_rollback;