7 use Test
::More tests
=> 7;
14 my $module = new Test
::MockModule
('C4::Context');
18 my $dbh = DBI
->connect( 'DBI:Mock:', '', '' )
19 || die "Cannot create handle: $DBI::errstr\n";
24 [ 'imagenumber', 'biblionumber', 'mimetype', 'imagefile', 'thumbnail' ],
25 [ 1, 2, 'gif', 'red', 001, 000 ],
26 [ 3, 2, 'jpeg', 'blue', 111, 110 ]
28 my $dbh = C4
::Context
->dbh();
30 $dbh->{mock_add_resultset
} = $images;
32 my $image = C4
::Images
::RetrieveImage
();
34 is
( $image->{'imagenumber'}, 1, 'First imagenumber is 1' );
36 is
( $image->{'mimetype'}, 'gif', 'First mimetype is red' );
38 is
( $image->{'thumbnail'}, 001, 'First thumbnail is 001' );
40 $image = C4
::Images
::RetrieveImage
();
42 $image = C4
::Images
::RetrieveImage
();
44 $dbh->{mock_add_resultset
} = $images;
46 my @imagenumbers = C4
::Images
::ListImagesForBiblio
();
48 is
( $imagenumbers[0], 1, 'imagenumber is 1' );
50 is
( $imagenumbers[1], 3, 'imagenumber is 3' );
52 $dbh->{mock_add_resultset
} = $images;
54 is
( $imagenumbers[4], undef, 'imagenumber undef' );