|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 14; |
22 |
use Test::More tests => 23; |
| 23 |
use Test::Exception; |
23 |
use Test::Exception; |
| 24 |
|
24 |
|
| 25 |
use FindBin '$Bin'; |
25 |
use FindBin '$Bin'; |
|
Lines 96-99
Koha::CoverImage->new(
Link Here
|
| 96 |
is( $biblio->cover_images->count, 3, ); |
96 |
is( $biblio->cover_images->count, 3, ); |
| 97 |
is( $item->cover_images->count, 2, ); |
97 |
is( $item->cover_images->count, 2, ); |
| 98 |
|
98 |
|
|
|
99 |
$logo_filepath = "$Bin/../../../koha-tmpl/intranet-tmpl/prog/img/koha-logo.gif"; |
| 100 |
my $mimetype = 'image/gif'; |
| 101 |
$image = Koha::CoverImage->new( |
| 102 |
{ |
| 103 |
biblionumber => $biblio->biblionumber, |
| 104 |
src_image => GD::Image->new($logo_filepath), |
| 105 |
mimetype => $mimetype |
| 106 |
} |
| 107 |
)->store; |
| 108 |
$cover_image = $biblio->cover_images->last; |
| 109 |
ok( $cover_image->imagefile, 'image is stored in imagefile' ); |
| 110 |
ok( $cover_image->thumbnail, 'thumbnail has been generated' ); |
| 111 |
is( |
| 112 |
$cover_image->mimetype, $mimetype, |
| 113 |
'The original mimetype has been kept' |
| 114 |
); |
| 115 |
|
| 116 |
$logo_filepath = "$Bin/../../../koha-tmpl/intranet-tmpl/prog/img/koha-logo.png"; |
| 117 |
$mimetype = 'image/png'; |
| 118 |
$image = Koha::CoverImage->new( |
| 119 |
{ |
| 120 |
biblionumber => $biblio->biblionumber, |
| 121 |
src_image => GD::Image->new($logo_filepath), |
| 122 |
mimetype => $mimetype |
| 123 |
} |
| 124 |
)->store; |
| 125 |
$cover_image = $biblio->cover_images->last; |
| 126 |
ok( $cover_image->imagefile, 'image is stored in imagefile' ); |
| 127 |
ok( $cover_image->thumbnail, 'thumbnail has been generated' ); |
| 128 |
is( |
| 129 |
$cover_image->mimetype, $mimetype, |
| 130 |
'The original mimetype has been kept' |
| 131 |
); |
| 132 |
|
| 133 |
$logo_filepath = "$Bin/../../../koha-tmpl/intranet-tmpl/lib/greybox/GreyBox_v5_5/static_files/night_valley.jpg"; |
| 134 |
$mimetype = 'image/jpeg'; |
| 135 |
$image = Koha::CoverImage->new( |
| 136 |
{ |
| 137 |
biblionumber => $biblio->biblionumber, |
| 138 |
src_image => GD::Image->new($logo_filepath), |
| 139 |
mimetype => $mimetype |
| 140 |
} |
| 141 |
)->store; |
| 142 |
$cover_image = $biblio->cover_images->last; |
| 143 |
ok( $cover_image->imagefile, 'image is stored in imagefile' ); |
| 144 |
ok( $cover_image->thumbnail, 'thumbnail has been generated' ); |
| 145 |
is( |
| 146 |
$cover_image->mimetype, $mimetype, |
| 147 |
'The original mimetype has been kept' |
| 148 |
); |
| 99 |
$schema->storage->txn_rollback; |
149 |
$schema->storage->txn_rollback; |