|
Lines 1-5
Link Here
|
|
|
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. |
| 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 |
|
| 1 |
use Modern::Perl; |
18 |
use Modern::Perl; |
|
|
19 |
|
| 2 |
use Test::More tests => 5; |
20 |
use Test::More tests => 5; |
|
|
21 |
use Test::MockModule; |
| 3 |
|
22 |
|
| 4 |
use C4::Biblio; |
23 |
use C4::Biblio; |
| 5 |
use C4::Circulation; |
24 |
use C4::Circulation; |
|
Lines 12-28
use t::lib::TestBuilder;
Link Here
|
| 12 |
|
31 |
|
| 13 |
use MARC::Record; |
32 |
use MARC::Record; |
| 14 |
|
33 |
|
| 15 |
*C4::Context::userenv = \&Mock_userenv; |
|
|
| 16 |
|
| 17 |
my $schema = Koha::Database->schema; |
34 |
my $schema = Koha::Database->schema; |
| 18 |
$schema->storage->txn_begin; |
35 |
$schema->storage->txn_begin; |
| 19 |
my $builder = t::lib::TestBuilder->new; |
36 |
my $builder = t::lib::TestBuilder->new; |
| 20 |
my $dbh = C4::Context->dbh; |
|
|
| 21 |
|
37 |
|
| 22 |
my $library = $builder->build({ |
38 |
my $library = $builder->build({ |
| 23 |
source => 'Branch', |
39 |
source => 'Branch', |
| 24 |
}); |
40 |
}); |
| 25 |
|
41 |
|
|
|
42 |
my $module = new Test::MockModule('C4::Context'); |
| 43 |
$module->mock('userenv', sub { |
| 44 |
{ |
| 45 |
branch => $library->{branchcode} |
| 46 |
} |
| 47 |
}); |
| 48 |
|
| 26 |
my $borrowernumber = AddMember( |
49 |
my $borrowernumber = AddMember( |
| 27 |
firstname => 'my firstname', |
50 |
firstname => 'my firstname', |
| 28 |
surname => 'my surname', |
51 |
surname => 'my surname', |
|
Lines 60-66
is(
Link Here
|
| 60 |
|
83 |
|
| 61 |
$schema->storage->txn_rollback; |
84 |
$schema->storage->txn_rollback; |
| 62 |
|
85 |
|
| 63 |
# C4::Context->userenv |
86 |
1; |
| 64 |
sub Mock_userenv { |
|
|
| 65 |
return { branch => $library->{branchcode} }; |
| 66 |
} |