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

(-)a/t/db_dependent/Holds.t (-20 / +16 lines)
Lines 8-13 use Test::More tests => 19; Link Here
8
use MARC::Record;
8
use MARC::Record;
9
use C4::Biblio;
9
use C4::Biblio;
10
use C4::Items;
10
use C4::Items;
11
use C4::Members;
11
12
12
BEGIN {
13
BEGIN {
13
    use FindBin;
14
    use FindBin;
Lines 15-20 BEGIN { Link Here
15
    use_ok('C4::Reserves');
16
    use_ok('C4::Reserves');
16
}
17
}
17
18
19
my $dbh = C4::Context->dbh;
20
21
# Start transaction
22
$dbh->{AutoCommit} = 0;
23
$dbh->{RaiseError} = 1;
24
18
my $borrowers_count = 5;
25
my $borrowers_count = 5;
19
26
20
# Setup Test------------------------
27
# Setup Test------------------------
Lines 26-39 my ($bibnum, $title, $bibitemnum) = create_helper_biblio(); Link Here
26
diag("Creating item instance for testing.");
33
diag("Creating item instance for testing.");
27
my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum);
34
my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum);
28
35
29
# Get a borrower
36
# Create some borrowers
30
my $dbh = C4::Context->dbh;
31
my $query = "SELECT borrowernumber FROM borrowers LIMIT $borrowers_count";
32
my $sth = $dbh->prepare($query);
33
$sth->execute;
34
my @borrowernumbers;
37
my @borrowernumbers;
35
while ( my $row = $sth->fetchrow_hashref ) {
38
foreach (1..$borrowers_count) {
36
    push( @borrowernumbers, $row->{'borrowernumber'} );
39
    my $borrowernumber = AddMember(
40
        firstname =>  'my firstname',
41
        surname => 'my surname ' . $_,
42
        categorycode => 'S',
43
        branchcode => 'CPL',
44
    );
45
    push @borrowernumbers, $borrowernumber;
37
}
46
}
38
47
39
my $biblionumber   = $bibnum;
48
my $biblionumber   = $bibnum;
Lines 155-172 AlterPriority( 'bottom', $reserve->{'reserve_id'} ); Link Here
155
$reserve = GetReserve( $reserve->{'reserve_id'} );
164
$reserve = GetReserve( $reserve->{'reserve_id'} );
156
ok( $reserve->{'priority'} eq '5', "Test AlterPriority(), move to bottom" );
165
ok( $reserve->{'priority'} eq '5', "Test AlterPriority(), move to bottom" );
157
166
158
# Delete the reserves
159
diag("Deleting holds.");
160
$dbh->do("DELETE FROM reserves WHERE biblionumber = ?", undef, ( $biblionumber ) );
161
162
# Delete item.
163
diag("Deleting item testing instance.");
164
DelItem($dbh, $bibnum, $itemnumber);
165
166
# Delete helper Biblio.
167
diag("Deleting biblio testing instance.");
168
DelBiblio($bibnum);
169
170
# Helper method to set up a Biblio.
167
# Helper method to set up a Biblio.
171
sub create_helper_biblio {
168
sub create_helper_biblio {
172
    my $bib = MARC::Record->new();
169
    my $bib = MARC::Record->new();
173
- 

Return to bug 9394