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

(-)a/t/db_dependent/CourseReserves.t (-16 / +27 lines)
Lines 1-7 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
2
#
14
#
3
# This is to test C4/Members
15
# You should have received a copy of the GNU General Public License
4
# It requires a working Koha database with the sample data
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
5
17
6
use Modern::Perl;
18
use Modern::Perl;
7
19
Lines 25-52 my $builder = t::lib::TestBuilder->new; Link Here
25
my $dbh = C4::Context->dbh;
37
my $dbh = C4::Context->dbh;
26
$dbh->{RaiseError} = 1;
38
$dbh->{RaiseError} = 1;
27
39
28
my $library = $builder->build( { source => 'Branch' } );
40
my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode};
29
my $itemtype = $builder->build(
41
my $itemtype = $builder->build(
30
    { source => 'Itemtype', value => { notforloan => undef } } )->{itemtype};
42
    { source => 'Itemtype', value => { notforloan => undef } } )->{itemtype};
31
43
32
my $sth = $dbh->prepare("SELECT * FROM borrowers ORDER BY RAND() LIMIT 10");
44
# Create 10 sample borrowers
33
$sth->execute();
45
my @borrowers = ();
34
my @borrowers = @{ $sth->fetchall_arrayref( {} ) };
46
foreach (1..10) {
47
    push @borrowers, $builder->build({ source => 'Borrower' });
48
}
35
49
36
# Create the item
50
# Create the a record with an item
37
my $record = MARC::Record->new();
51
my $record = MARC::Record->new;
38
$record->append_fields(
39
    MARC::Field->new( '952', '0', '0', a => $library->{branchcode}, b => $library->{branchcode} )
40
);
41
my ( $biblionumber, $biblioitemnumber ) = C4::Biblio::AddBiblio($record, '');
52
my ( $biblionumber, $biblioitemnumber ) = C4::Biblio::AddBiblio($record, '');
42
my @iteminfo = C4::Items::AddItem(
53
my ( undef, undef, $itemnumber ) = C4::Items::AddItem(
43
    {   homebranch    => $library->{branchcode},
54
    {   homebranch    => $branchcode,
44
        holdingbranch => $library->{branchcode},
55
        holdingbranch => $branchcode,
45
        itype         => $itemtype
56
        itype         => $itemtype
46
    },
57
    },
47
    $biblionumber
58
    $biblionumber
48
);
59
);
49
my $itemnumber = $iteminfo[2];
50
60
51
my $course_id = ModCourse(
61
my $course_id = ModCourse(
52
    course_name => "Test Course",
62
    course_name => "Test Course",
Lines 125-127 ok( !defined( $course_reserve->{'cr_id'} ), "DelCourseReserve functions correctl Link Here
125
DelCourse($course_id);
135
DelCourse($course_id);
126
$course = GetCourse($course_id);
136
$course = GetCourse($course_id);
127
ok( !defined( $course->{'course_id'} ), "DelCourse deleted course successfully" );
137
ok( !defined( $course->{'course_id'} ), "DelCourse deleted course successfully" );
128
- 
138
139
$schema->storage->txn_rollback;

Return to bug 17716