|
Lines 76-82
subtest 'Failure tests' => sub {
Link Here
|
| 76 |
|
76 |
|
| 77 |
subtest 'Anonymous patron tests' => sub { |
77 |
subtest 'Anonymous patron tests' => sub { |
| 78 |
|
78 |
|
| 79 |
plan tests => 2; |
79 |
plan tests => 3; |
| 80 |
|
80 |
|
| 81 |
$schema->storage->txn_begin; |
81 |
$schema->storage->txn_begin; |
| 82 |
|
82 |
|
|
Lines 99-106
subtest 'Anonymous patron tests' => sub {
Link Here
|
| 99 |
t::lib::Mocks::mock_preference( 'AnonymousPatron', '' ); |
99 |
t::lib::Mocks::mock_preference( 'AnonymousPatron', '' ); |
| 100 |
|
100 |
|
| 101 |
my $issue = C4::Circulation::AddIssue( $patron->unblessed, $item->barcode ); |
101 |
my $issue = C4::Circulation::AddIssue( $patron->unblessed, $item->barcode ); |
| 102 |
eval { C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item->itemnumber, undef, 2 ) }; |
102 |
|
| 103 |
like ( $@, qr<Fatal error: the patron \(\d+\) .* AnonymousPatron>, 'AnonymousPatron is not set - Fatal error on anonymization' ); |
103 |
throws_ok |
|
|
104 |
{ C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item->itemnumber, undef, 2 ); } |
| 105 |
'Koha::Exceptions::SysPref::NotSet', |
| 106 |
'AnonymousPatron not set causes an exception'; |
| 107 |
|
| 108 |
is( $@->syspref, 'AnonymousPatron', 'AnonymousPatron is not set - Fatal error on anonymization' ); |
| 104 |
Koha::Checkouts->find( $issue->issue_id )->delete; |
109 |
Koha::Checkouts->find( $issue->issue_id )->delete; |
| 105 |
|
110 |
|
| 106 |
# Create a valid anonymous user |
111 |
# Create a valid anonymous user |
| 107 |
- |
|
|