Lines 1-9
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
|
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. |
14 |
# |
15 |
# You should have received a copy of the GNU General Public License |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
17 |
|
18 |
|
3 |
use Modern::Perl; |
19 |
use Modern::Perl; |
4 |
|
20 |
|
5 |
use Test::More tests => 3; |
21 |
use Test::More tests => 3; |
6 |
use Test::MockModule; |
22 |
use Test::MockModule; |
|
|
23 |
use t::lib::TestBuilder; |
7 |
|
24 |
|
8 |
use C4::Biblio; |
25 |
use C4::Biblio; |
9 |
use C4::Items; |
26 |
use C4::Items; |
Lines 16-24
use DateTime::Duration;
Link Here
|
16 |
|
33 |
|
17 |
use MARC::Record; |
34 |
use MARC::Record; |
18 |
|
35 |
|
|
|
36 |
my $schema = Koha::Database->schema; |
37 |
$schema->storage->txn_begin; |
19 |
my $dbh = C4::Context->dbh; |
38 |
my $dbh = C4::Context->dbh; |
20 |
$dbh->{AutoCommit} = 0; |
|
|
21 |
$dbh->{RaiseError} = 1; |
22 |
|
39 |
|
23 |
$dbh->do(q|DELETE FROM issues|); |
40 |
$dbh->do(q|DELETE FROM issues|); |
24 |
$dbh->do(q|DELETE FROM borrowers|); |
41 |
$dbh->do(q|DELETE FROM borrowers|); |
Lines 28-45
$dbh->do(q|DELETE FROM biblio|);
Link Here
|
28 |
$dbh->do(q|DELETE FROM categories|); |
45 |
$dbh->do(q|DELETE FROM categories|); |
29 |
$dbh->do(q|DELETE FROM letter|); |
46 |
$dbh->do(q|DELETE FROM letter|); |
30 |
|
47 |
|
31 |
my $branchcode = 'B'; |
48 |
my $builder = t::lib::TestBuilder->new; |
32 |
Koha::Library->new( { branchcode => $branchcode, branchname => 'Branch' } )->store; |
|
|
33 |
|
49 |
|
34 |
my $categorycode = 'C'; |
50 |
my $branchcode = $builder->build({ source => 'Branch' })->{ branchcode }; |
35 |
$dbh->do( "INSERT INTO categories(categorycode) VALUES(?)", |
51 |
my $categorycode = $builder->build({ source => 'Category' })->{ categorycode }; |
36 |
undef, $categorycode ); |
52 |
my $itemtype = $builder->build({ source => 'Itemtype' })->{ itemtype }; |
37 |
|
53 |
|
38 |
my %item_branch_infos = ( |
54 |
my %item_infos = ( |
39 |
homebranch => $branchcode, |
55 |
homebranch => $branchcode, |
40 |
holdingbranch => $branchcode, |
56 |
holdingbranch => $branchcode, |
|
|
57 |
itype => $itemtype |
41 |
); |
58 |
); |
42 |
|
59 |
|
|
|
60 |
|
43 |
my $slip_content = <<EOS; |
61 |
my $slip_content = <<EOS; |
44 |
Checked out: |
62 |
Checked out: |
45 |
<checkedout> |
63 |
<checkedout> |
Lines 84-90
$record->append_fields(
Link Here
|
84 |
); |
102 |
); |
85 |
my ($biblionumber1) = AddBiblio( $record, '' ); |
103 |
my ($biblionumber1) = AddBiblio( $record, '' ); |
86 |
my $itemnumber1 = |
104 |
my $itemnumber1 = |
87 |
AddItem( { barcode => $barcode1, %item_branch_infos }, $biblionumber1 ); |
105 |
AddItem( { barcode => $barcode1, %item_infos }, $biblionumber1 ); |
88 |
|
106 |
|
89 |
$record = MARC::Record->new; |
107 |
$record = MARC::Record->new; |
90 |
$record->append_fields( |
108 |
$record->append_fields( |
Lines 95-101
$record->append_fields(
Link Here
|
95 |
); |
113 |
); |
96 |
my ($biblionumber2) = AddBiblio( $record, '' ); |
114 |
my ($biblionumber2) = AddBiblio( $record, '' ); |
97 |
my $itemnumber2 = |
115 |
my $itemnumber2 = |
98 |
AddItem( { barcode => $barcode2, %item_branch_infos }, $biblionumber2 ); |
116 |
AddItem( { barcode => $barcode2, %item_infos }, $biblionumber2 ); |
99 |
|
117 |
|
100 |
my $borrowernumber = |
118 |
my $borrowernumber = |
101 |
AddMember( categorycode => $categorycode, branchcode => $branchcode ); |
119 |
AddMember( categorycode => $categorycode, branchcode => $branchcode ); |
Lines 394-396
EOS
Link Here
|
394 |
$slip = IssueSlip(undef, $borrowernumber+1); |
412 |
$slip = IssueSlip(undef, $borrowernumber+1); |
395 |
is( $slip->{content}, $empty_slip, 'IssueSlip should not return an empty slip if the borrowernumber passed in param does not exist. But it is what it does for now (FIXME)' ); |
413 |
is( $slip->{content}, $empty_slip, 'IssueSlip should not return an empty slip if the borrowernumber passed in param does not exist. But it is what it does for now (FIXME)' ); |
396 |
}; |
414 |
}; |
397 |
- |
415 |
|
|
|
416 |
$schema->storage->txn_rollback; |
417 |
|
418 |
1; |