Bugzilla – Attachment 12003 Details for
Bug 5327
Omnibus for unit tests required for all C4 modules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED-QA]Bug 5327: Testing c4 Images
Bug-5327-Testing-c4-Images.patch (text/plain), 1.76 KB, created by
Jonathan Druart
on 2012-09-06 10:25:16 UTC
(
hide
)
Description:
[PASSED-QA]Bug 5327: Testing c4 Images
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2012-09-06 10:25:16 UTC
Size:
1.76 KB
patch
obsolete
>From 2c03956191fcb65f6a8d926a722570b0f67501f6 Mon Sep 17 00:00:00 2001 >From: Bart Jorgensen <bart.tj@gmail.com> >Date: Thu, 23 Aug 2012 16:58:24 +1200 >Subject: [PATCH] Bug 5327: Testing c4 Images > >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >--- > t/Images.t | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 54 insertions(+) > create mode 100644 t/Images.t > >diff --git a/t/Images.t b/t/Images.t >new file mode 100644 >index 0000000..c35d5bd >--- /dev/null >+++ b/t/Images.t >@@ -0,0 +1,54 @@ >+#!/usr/bin/perl >+# >+#Testing C4 Images >+ >+use strict; >+use warnings; >+use Test::More tests => 7; >+use Test::MockModule; >+ >+BEGIN { >+ use_ok('C4::Images'); >+} >+ >+my $module = new Test::MockModule('C4::Context'); >+$module->mock( >+ '_new_dbh', >+ sub { >+ my $dbh = DBI->connect( 'DBI:Mock:', '', '' ) >+ || die "Cannot create handle: $DBI::errstr\n"; >+ return $dbh; >+ } >+); >+my $images = [ >+ [ 'imagenumber', 'biblionumber', 'mimetype', 'imagefile', 'thumbnail' ], >+ [ 1, 2, 'gif', 'red', 001, 000 ], >+ [ 3, 2, 'jpeg', 'blue', 111, 110 ] >+]; >+my $dbh = C4::Context->dbh(); >+ >+$dbh->{mock_add_resultset} = $images; >+ >+my $image = C4::Images::RetrieveImage(); >+ >+is( $image->{'imagenumber'}, 1, 'First imagenumber is 1' ); >+ >+is( $image->{'mimetype'}, 'gif', 'First mimetype is red' ); >+ >+is( $image->{'thumbnail'}, 001, 'First thumbnail is 001' ); >+ >+$image = C4::Images::RetrieveImage(); >+ >+$image = C4::Images::RetrieveImage(); >+ >+$dbh->{mock_add_resultset} = $images; >+ >+my @imagenumbers = C4::Images::ListImagesForBiblio(); >+ >+is( $imagenumbers[0], 1, 'imagenumber is 1' ); >+ >+is( $imagenumbers[1], 3, 'imagenumber is 3' ); >+ >+$dbh->{mock_add_resultset} = $images; >+ >+is( $imagenumbers[4], undef, 'imagenumber undef' ); >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5327
:
2716
|
2726
|
5485
|
6236
|
6237
|
6373
|
6560
|
6561
|
6562
|
6563
|
6613
|
6614
|
6616
|
6620
|
6621
|
6622
|
6643
|
6650
|
6655
|
6679
|
6681
|
6682
|
6683
|
6726
|
6727
|
6728
|
6729
|
6730
|
6731
|
6732
|
6795
|
6799
|
6805
|
6819
|
6826
|
6827
|
6828
|
6834
|
7179
|
7180
|
7181
|
7182
|
7183
|
7184
|
7185
|
7186
|
7187
|
7188
|
7189
|
7190
|
7191
|
7192
|
7194
|
7195
|
7203
|
7206
|
7208
|
7209
|
7220
|
7221
|
7222
|
7223
|
7224
|
7225
|
7226
|
7227
|
7228
|
7229
|
7230
|
7231
|
7232
|
7233
|
7234
|
7235
|
7236
|
7237
|
7238
|
7239
|
7240
|
7241
|
7242
|
7400
|
7402
|
7403
|
7405
|
7573
|
7592
|
7593
|
7594
|
9897
|
10234
|
10616
|
10656
|
10659
|
10660
|
10661
|
10680
|
11141
|
11186
|
11212
|
11213
|
11278
|
11279
|
11280
|
11281
|
11339
|
11340
|
11341
|
11440
|
11467
|
11469
|
11470
|
11471
|
11472
|
11473
|
11500
|
11503
|
11505
|
11506
|
11633
|
11762
|
11763
|
11764
|
11765
|
11846
|
11985
|
11993
|
12002
|
12003