|
Lines 20-41
use Modern::Perl;
Link Here
|
| 20 |
use Test::More tests => 2; |
20 |
use Test::More tests => 2; |
| 21 |
use Test::Warn; |
21 |
use Test::Warn; |
| 22 |
|
22 |
|
|
|
23 |
use t::lib::Mocks; |
| 24 |
use t::lib::TestBuilder; |
| 25 |
|
| 23 |
use C4::Circulation; |
26 |
use C4::Circulation; |
| 24 |
use C4::Members; |
27 |
use C4::Members; |
| 25 |
use Koha::Library; |
28 |
use Koha::Library; |
| 26 |
use t::lib::Mocks; |
|
|
| 27 |
|
29 |
|
|
|
30 |
my $schema = Koha::Database->schema; |
| 28 |
my $dbh = C4::Context->dbh; |
31 |
my $dbh = C4::Context->dbh; |
| 29 |
$dbh->{AutoCommit} = 0; |
|
|
| 30 |
$dbh->{RaiseError} = 1; |
| 31 |
|
32 |
|
| 32 |
t::lib::Mocks::mock_preference('AnonymousPatron', ''); |
33 |
$schema->storage->txn_begin; |
| 33 |
|
34 |
|
| 34 |
my $branchcode = 'B'; |
35 |
my $builder = t::lib::TestBuilder->new; |
| 35 |
Koha::Library->new({ branchcode => $branchcode, branchname => 'Branch' })->store; |
|
|
| 36 |
|
36 |
|
| 37 |
my $categorycode = 'C'; |
37 |
t::lib::Mocks::mock_preference('AnonymousPatron', ''); |
| 38 |
$dbh->do("INSERT INTO categories(categorycode) VALUES(?)", undef, $categorycode); |
38 |
|
|
|
39 |
my $branchcode = $builder->build({ source => 'Branch' })->{ branchcode }; |
| 40 |
my $categorycode = $builder->build({ source => 'Category' })->{ categorycode }; |
| 39 |
|
41 |
|
| 40 |
my %item_branch_infos = ( |
42 |
my %item_branch_infos = ( |
| 41 |
homebranch => $branchcode, |
43 |
homebranch => $branchcode, |
|
Lines 53-55
t::lib::Mocks::mock_preference('AnonymousPatron', $anonymous_borrowernumber);
Link Here
|
| 53 |
$dbh->{PrintError} = 0; |
55 |
$dbh->{PrintError} = 0; |
| 54 |
eval { C4::Circulation::MarkIssueReturned( $borrowernumber, 'itemnumber', 'dropbox_branch', 'returndate', 2 ) }; |
56 |
eval { C4::Circulation::MarkIssueReturned( $borrowernumber, 'itemnumber', 'dropbox_branch', 'returndate', 2 ) }; |
| 55 |
unlike ( $@, qr<Fatal error: the patron \(\d+\) .* AnonymousPatron>, ); |
57 |
unlike ( $@, qr<Fatal error: the patron \(\d+\) .* AnonymousPatron>, ); |
| 56 |
- |
58 |
|
|
|
59 |
$schema->storage->txn_rollback; |
| 60 |
|
| 61 |
1; |