View | Details | Raw Unified | Return to bug 10389
Collapse All | Expand All

(-)a/t/db_dependent/VirtualShelves.t (-2 / +28 lines)
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 => 83;
8
use Test::More tests => 95;
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 202-207 else { Link Here
202
    is(1+$cnt2, $cnt3, "Added one new share record with invitekey");
202
    is(1+$cnt2, $cnt3, "Added one new share record with invitekey");
203
}
203
}
204
204
205
#----------------------- TEST AcceptShare -------------------------------------#
206
207
# test accepting a wrong key
208
my $testkey= 'keyisgone9';
209
my $acctest="delete from virtualshelfshares where invitekey=?";
210
$dbh->do($acctest,undef,($testkey)); #just be sure it does not exist
211
$acctest="select shelfnumber from virtualshelves";
212
my ($accshelf)= $dbh->selectrow_array($acctest);
213
is(AcceptShare($accshelf,$testkey,$borrowers[0]),undef,'Did not accept invalid key');
214
215
# test accepting a good key
216
if( AddShare($accshelf,$testkey) && $borrowers[0] ) {
217
    is(AcceptShare($accshelf, $testkey, $borrowers[0]),1,'Accepted share');
218
}
219
else { #cannot accept if addshared failed somehow
220
    ok(1, 'Skipped second AcceptShare test');
221
}
222
223
#----------------------- TEST IsSharedList ------------------------------------#
224
225
for my $i (0..9) {
226
    my $sql="select count(*) from virtualshelfshares where shelfnumber=? and borrowernumber is not null";
227
    my $sh=$shelves[$i]->{number};
228
    my ($n)=$dbh->selectrow_array($sql,undef,($sh));
229
    is(IsSharedList($sh),$n? 1: '', "Checked IsSharedList for shelf $sh");
230
}
231
205
#----------------TEST DelShelf & DelFromShelf functions------------------------#
232
#----------------TEST DelShelf & DelFromShelf functions------------------------#
206
233
207
for my $i (0..9){
234
for my $i (0..9){
208
- 

Return to bug 10389