Lines 193-204
subtest 'can_be_transferred' => sub {
Link Here
|
193 |
}; |
193 |
}; |
194 |
|
194 |
|
195 |
subtest 'custom_cover_image_url' => sub { |
195 |
subtest 'custom_cover_image_url' => sub { |
196 |
plan tests => 4; |
196 |
plan tests => 6; |
197 |
|
197 |
|
198 |
t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/{isbn}_{issn}.png' ); |
198 |
t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/{isbn}_{issn}.png' ); |
199 |
|
199 |
|
200 |
my $isbn = '0553573403 | 9780553573404 (pbk.).png'; |
200 |
my $isbn = '0553573403 | 9780553573404 (pbk.).png'; |
201 |
my $issn = 'my_issn'; |
201 |
my $issn = 'my_issn'; |
|
|
202 |
my $cf_value = 'from_control_field'; |
202 |
my $marc_record = MARC::Record->new; |
203 |
my $marc_record = MARC::Record->new; |
203 |
my ( $biblionumber, undef ) = C4::Biblio::AddBiblio($marc_record, ''); |
204 |
my ( $biblionumber, undef ) = C4::Biblio::AddBiblio($marc_record, ''); |
204 |
|
205 |
|
Lines 221-226
subtest 'custom_cover_image_url' => sub {
Link Here
|
221 |
$biblio->biblioitem->isbn('')->store; |
222 |
$biblio->biblioitem->isbn('')->store; |
222 |
is( $biblio->custom_cover_image_url, undef, "Don't generate the url if the biblio does not have the value needed to generate it" ); |
223 |
is( $biblio->custom_cover_image_url, undef, "Don't generate the url if the biblio does not have the value needed to generate it" ); |
223 |
|
224 |
|
|
|
225 |
t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/{001}.png' ); |
226 |
is( $biblio->custom_cover_image_url, undef, 'Record does not have 001' ); |
227 |
$marc_record->append_fields(MARC::Field->new('001', $cf_value)); |
228 |
C4::Biblio::ModBiblio( $marc_record, $biblio->biblionumber ); |
229 |
$biblio = Koha::Biblios->find( $biblionumber ); |
230 |
is( $biblio->get_from_storage->custom_cover_image_url, "https://my_url/$cf_value.png", 'URL generated using 001' ); |
224 |
}; |
231 |
}; |
225 |
|
232 |
|
226 |
$schema->storage->txn_rollback; |
233 |
$schema->storage->txn_rollback; |
227 |
- |
|
|