Lines 36-55
my $builder = t::lib::TestBuilder->new;
Link Here
|
36 |
|
36 |
|
37 |
t::lib::Mocks::mock_preference('AnonymousPatron', ''); |
37 |
t::lib::Mocks::mock_preference('AnonymousPatron', ''); |
38 |
|
38 |
|
39 |
my $branchcode = $builder->build({ source => 'Branch' })->{ branchcode }; |
39 |
my $library = $builder->build({ source => 'Branch' }); |
40 |
my $categorycode = $builder->build({ source => 'Category' })->{ categorycode }; |
40 |
my $categorycode = $builder->build({ source => 'Category' })->{ categorycode }; |
41 |
|
41 |
|
|
|
42 |
C4::Context->_new_userenv('xxx'); |
43 |
C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, $library->{branchname}, '', '', ''); |
44 |
|
42 |
my %item_branch_infos = ( |
45 |
my %item_branch_infos = ( |
43 |
homebranch => $branchcode, |
46 |
homebranch => $library->{branchcode}, |
44 |
holdingbranch => $branchcode, |
47 |
holdingbranch => $library->{branchcode}, |
45 |
); |
48 |
); |
46 |
|
49 |
|
47 |
my $borrowernumber = AddMember( categorycode => $categorycode, branchcode => $branchcode ); |
50 |
my $borrowernumber = AddMember( categorycode => $categorycode, branchcode => $library->{branchcode} ); |
|
|
51 |
my $patron_category = $builder->build({ source => 'Category', value => { categorycode => 'NOT_X', category_type => 'P', enrolmentfee => 0 } }); |
52 |
my $patron = $builder->build({ source => 'Borrower', value => { branchcode => $library->{branchcode}, categorycode => $patron_category->{categorycode} } } ); |
53 |
|
54 |
my $biblioitem = $builder->build( { source => 'Biblioitem' } ); |
55 |
my $item = $builder->build( |
56 |
{ |
57 |
source => 'Item', |
58 |
value => { |
59 |
homebranch => $library->{branchcode}, |
60 |
holdingbranch => $library->{branchcode}, |
61 |
notforloan => 0, |
62 |
itemlost => 0, |
63 |
withdrawn => 0, |
64 |
biblionumber => $biblioitem->{biblionumber}, |
65 |
} |
66 |
} |
67 |
); |
68 |
C4::Circulation::AddIssue( $patron, $item->{barcode} ); |
48 |
|
69 |
|
49 |
eval { C4::Circulation::MarkIssueReturned( $borrowernumber, 'itemnumber', 'dropbox_branch', 'returndate', 2 ) }; |
70 |
eval { C4::Circulation::MarkIssueReturned( $borrowernumber, $item->{itemnumber}, 'dropbox_branch', 'returndate', 2 ) }; |
50 |
like ( $@, qr<Fatal error: the patron \(\d+\) .* AnonymousPatron>, ); |
71 |
like ( $@, qr<Fatal error: the patron \(\d+\) .* AnonymousPatron>, ); |
51 |
|
72 |
|
52 |
my $anonymous_borrowernumber = AddMember( categorycode => $categorycode, branchcode => $branchcode ); |
73 |
my $anonymous_borrowernumber = AddMember( categorycode => $categorycode, branchcode => $library->{branchcode} ); |
53 |
t::lib::Mocks::mock_preference('AnonymousPatron', $anonymous_borrowernumber); |
74 |
t::lib::Mocks::mock_preference('AnonymousPatron', $anonymous_borrowernumber); |
54 |
# The next call will raise an error, because data are not correctly set |
75 |
# The next call will raise an error, because data are not correctly set |
55 |
$dbh->{PrintError} = 0; |
76 |
$dbh->{PrintError} = 0; |
56 |
- |
|
|