Lines 5-11
Link Here
|
5 |
# Larger modifications by Jonathan Druart and Marcel de Rooy |
5 |
# Larger modifications by Jonathan Druart and Marcel de Rooy |
6 |
|
6 |
|
7 |
use Modern::Perl; |
7 |
use Modern::Perl; |
8 |
use Test::More tests => 71; |
8 |
use Test::More tests => 83; |
9 |
use MARC::Record; |
9 |
use MARC::Record; |
10 |
|
10 |
|
11 |
use C4::Biblio qw( AddBiblio DelBiblio ); |
11 |
use C4::Biblio qw( AddBiblio DelBiblio ); |
Lines 177-182
for my $i(0..9){
Link Here
|
177 |
} |
177 |
} |
178 |
} |
178 |
} |
179 |
|
179 |
|
|
|
180 |
#----------------------- TEST AddShare ----------------------------------------# |
181 |
|
182 |
#first count the number of shares in the table; keep in mind that AddShare may |
183 |
#delete some expired records while housekeeping |
184 |
my $sql_sharecount="select count(*) from virtualshelfshares where DATEDIFF(sharedate, NOW())>0"; |
185 |
my $cnt1=$dbh->selectrow_array($sql_sharecount); |
186 |
|
187 |
#try to add a share without shelfnumber: should fail |
188 |
AddShare(0, 'abcdefghij'); |
189 |
my $cnt2=$dbh->selectrow_array($sql_sharecount); |
190 |
ok($cnt1 == $cnt2, "Did not add an invalid share record"); |
191 |
|
192 |
#add another share: should be okay |
193 |
#AddShare assumes that you tested if category==private (so we could actually |
194 |
#be doing something illegal here :) |
195 |
my $n=$shelves[0]->{number}; |
196 |
if($n<0) { |
197 |
ok(1, 'Skip AddShare for shelf -1'); |
198 |
} |
199 |
else { |
200 |
AddShare($n, 'abcdefghij'); |
201 |
my $cnt3=$dbh->selectrow_array($sql_sharecount); |
202 |
ok(1+$cnt2 == $cnt3, "Added one new share record with invitekey"); |
203 |
} |
204 |
|
205 |
#----------------TEST DelShelf & DelFromShelf functions------------------------# |
206 |
|
207 |
for(my $i=0; $i<10;$i++){ |
208 |
my $shelfnumber = $shelves[$i]->{number}; |
209 |
if($shelfnumber<0) { |
210 |
ok(1, 'Skip DelShelf for shelf -1'); |
211 |
next; |
212 |
} |
213 |
my $status = DelShelf($shelfnumber); |
214 |
ok(1 == $status, "deleted shelf $shelfnumber and its contents"); |
215 |
} |
216 |
|
180 |
#----------------------- SOME SUBS --------------------------------------------# |
217 |
#----------------------- SOME SUBS --------------------------------------------# |
181 |
|
218 |
|
182 |
sub randomname { |
219 |
sub randomname { |
183 |
- |
|
|