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 91-94
Koha::CoverImage->new(
Link Here
|
91 |
is( $biblio->cover_images->count, 3, ); |
91 |
is( $biblio->cover_images->count, 3, ); |
92 |
is( $item->cover_images->count, 2, ); |
92 |
is( $item->cover_images->count, 2, ); |
93 |
|
93 |
|
|
|
94 |
$logo_filepath = "$Bin/../../../koha-tmpl/intranet-tmpl/prog/img/koha-logo.gif"; |
95 |
my $mimetype = 'image/gif'; |
96 |
$image = Koha::CoverImage->new( |
97 |
{ |
98 |
biblionumber => $biblio->biblionumber, |
99 |
src_image => GD::Image->new($logo_filepath), |
100 |
mimetype => $mimetype |
101 |
} |
102 |
)->store; |
103 |
$cover_image = $biblio->cover_images->last; |
104 |
ok( $cover_image->imagefile, 'image is stored in imagefile' ); |
105 |
ok( $cover_image->thumbnail, 'thumbnail has been generated' ); |
106 |
is( |
107 |
$cover_image->mimetype, $mimetype, |
108 |
'The original mimetype has been kept' |
109 |
); |
110 |
|
111 |
$logo_filepath = "$Bin/../../../koha-tmpl/intranet-tmpl/prog/img/koha-logo.png"; |
112 |
$mimetype = 'image/png'; |
113 |
$image = Koha::CoverImage->new( |
114 |
{ |
115 |
biblionumber => $biblio->biblionumber, |
116 |
src_image => GD::Image->new($logo_filepath), |
117 |
mimetype => $mimetype |
118 |
} |
119 |
)->store; |
120 |
$cover_image = $biblio->cover_images->last; |
121 |
ok( $cover_image->imagefile, 'image is stored in imagefile' ); |
122 |
ok( $cover_image->thumbnail, 'thumbnail has been generated' ); |
123 |
is( |
124 |
$cover_image->mimetype, $mimetype, |
125 |
'The original mimetype has been kept' |
126 |
); |
127 |
|
128 |
$logo_filepath = "$Bin/../../../koha-tmpl/intranet-tmpl/lib/greybox/GreyBox_v5_5/static_files/night_valley.jpg"; |
129 |
$mimetype = 'image/jpeg'; |
130 |
$image = Koha::CoverImage->new( |
131 |
{ |
132 |
biblionumber => $biblio->biblionumber, |
133 |
src_image => GD::Image->new($logo_filepath), |
134 |
mimetype => $mimetype |
135 |
} |
136 |
)->store; |
137 |
$cover_image = $biblio->cover_images->last; |
138 |
ok( $cover_image->imagefile, 'image is stored in imagefile' ); |
139 |
ok( $cover_image->thumbnail, 'thumbnail has been generated' ); |
140 |
is( |
141 |
$cover_image->mimetype, $mimetype, |
142 |
'The original mimetype has been kept' |
143 |
); |
94 |
$schema->storage->txn_rollback; |
144 |
$schema->storage->txn_rollback; |