Bug 36473: Unit tests
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> [EDIT] Tidied. Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> (cherry picked from commit9e9cc822cb) Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> (cherry picked from commitd80334a108) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
2c3dacad48
commit
0505085ea9
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 20;
|
||||
use Test::More tests => 21;
|
||||
use Test::MockModule;
|
||||
use Test::Warn;
|
||||
use List::MoreUtils qw( uniq );
|
||||
|
|
@ -1022,6 +1022,27 @@ subtest 'ModBiblio on invalid record' => sub {
|
|||
);
|
||||
};
|
||||
|
||||
subtest 'UpdateTotalIssues on Invalid record' => sub {
|
||||
plan tests => 2;
|
||||
|
||||
my $return_record = Test::MockModule->new('Koha::Biblio::Metadata');
|
||||
$return_record->mock( 'record', sub { Koha::Exceptions::Metadata::Invalid->throw() } );
|
||||
|
||||
my $biblio = $builder->build_sample_biblio;
|
||||
|
||||
my $increase = 1;
|
||||
|
||||
my $success;
|
||||
warning_is {
|
||||
$success = C4::Biblio::UpdateTotalIssues( $biblio->biblionumber, $increase, '' );
|
||||
}
|
||||
"UpdateTotalIssues could not get biblio record", "Expected warning found";
|
||||
|
||||
ok( !$success, 'UpdateTotalIssues fails gracefully for invalid record' );
|
||||
|
||||
};
|
||||
|
||||
|
||||
# Cleanup
|
||||
Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" );
|
||||
$schema->storage->txn_rollback;
|
||||
|
|
|
|||
Loading…
Reference in New Issue