View | Details | Raw Unified | Return to bug 36473
Collapse All | Expand All

(-)a/C4/Biblio.pm (+1 lines)
Lines 3062-3067 sub UpdateTotalIssues { Link Here
3062
    if ($@) {
3062
    if ($@) {
3063
        my $exception = $@;
3063
        my $exception = $@;
3064
        $exception->rethrow unless ( $exception->isa('Koha::Exceptions::Metadata::Invalid') );
3064
        $exception->rethrow unless ( $exception->isa('Koha::Exceptions::Metadata::Invalid') );
3065
        warn $exception;
3065
        warn "UpdateTotalIssues could not get bibliographic record for biblionumber $biblionumber";
3066
        warn "UpdateTotalIssues could not get bibliographic record for biblionumber $biblionumber";
3066
        return;
3067
        return;
3067
    }
3068
    }
(-)a/t/db_dependent/Biblio.t (-6 / +19 lines)
Lines 1026-1043 subtest 'UpdateTotalIssues on Invalid record' => sub { Link Here
1026
    plan tests => 2;
1026
    plan tests => 2;
1027
1027
1028
    my $return_record = Test::MockModule->new('Koha::Biblio::Metadata');
1028
    my $return_record = Test::MockModule->new('Koha::Biblio::Metadata');
1029
    $return_record->mock( 'record', sub { Koha::Exceptions::Metadata::Invalid->throw() } );
1029
    $return_record->mock( 'record', sub {
1030
        my $self = shift;
1031
        Koha::Exceptions::Metadata::Invalid->throw(
1032
            id             => $self->id,
1033
            biblionumber   => $self->biblionumber,
1034
            format         => $self->format,
1035
            schema         => $self->schema,
1036
            decoding_error => "Error goes here",
1037
        );
1038
    } );
1030
1039
1031
    my $biblio = $builder->build_sample_biblio;
1040
    my $biblio             = $builder->build_sample_biblio;
1032
    my $biblionumber = $biblio->biblionumber;
1041
    my $biblionumber       = $biblio->biblionumber;
1042
    my $biblio_metadata_id = $biblio->metadata->id;
1033
1043
1034
    my $increase = 1;
1044
    my $increase = 1;
1035
1045
1036
    my $success;
1046
    my $success;
1037
    warning_is {
1047
    warnings_like {
1038
        $success = C4::Biblio::UpdateTotalIssues( $biblio->biblionumber, $increase, '' );
1048
        $success = C4::Biblio::UpdateTotalIssues( $biblio->biblionumber, $increase, '' );
1039
    }
1049
    }
1040
    "UpdateTotalIssues could not get bibliographic record for biblionumber $biblionumber", "Expected warning found";
1050
    [
1051
        qr/Invalid data, cannot decode metadata object/,
1052
        qr/UpdateTotalIssues could not get bibliographic record for biblionumber $biblionumber/
1053
    ],
1054
        "Expected warning found";
1041
1055
1042
    ok( !$success, 'UpdateTotalIssues fails gracefully for invalid record' );
1056
    ok( !$success, 'UpdateTotalIssues fails gracefully for invalid record' );
1043
1057
1044
- 

Return to bug 36473