}
subtest 'CanBookBeIssued & AllowReturnToBranch' => sub {
- plan tests => 23;
+ plan tests => 24;
my $homebranch = $builder->build( { source => 'Branch' } );
my $holdingbranch = $builder->build( { source => 'Branch' } );
# AllowReturnToBranch == anywhere
t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
+ ## Test that unknown barcodes don't generate internal server errors
+ set_userenv($homebranch);
+ ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, 'KohaIsAwesome' );
+ ok( $error->{UNKNOWN_BARCODE}, '"KohaIsAwesome" is not a valid barcode as expected.' );
## Can be issued from homebranch
set_userenv($homebranch);
( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->{barcode} );