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

(-)a/Koha/Object.pm (+15 lines)
Lines 375-380 sub add_message { Link Here
375
    return $self;
375
    return $self;
376
}
376
}
377
377
378
=head3 $object->reset_messages
379
380
    $object->reset_messages;
381
382
Reset the current object's messages.
383
384
=cut
385
386
sub reset_messages {
387
    my ( $self ) = @_;
388
389
    $self->{_messages} = [];
390
    return $self;
391
}
392
378
=head3 $object->TO_JSON
393
=head3 $object->TO_JSON
379
394
380
Returns an unblessed representation of the object, suitable for JSON output.
395
Returns an unblessed representation of the object, suitable for JSON output.
(-)a/t/db_dependent/Koha/Object.t (-3 / +10 lines)
Lines 868-876 subtest 'set_or_blank' => sub { Link Here
868
    $schema->storage->txn_rollback;
868
    $schema->storage->txn_rollback;
869
};
869
};
870
870
871
subtest 'messages() and add_message() tests' => sub {
871
subtest 'messages(), add_message() and reset_messages() tests' => sub {
872
872
873
    plan tests => 6;
873
    plan tests => 8;
874
874
875
    my $patron = Koha::Patron->new;
875
    my $patron = Koha::Patron->new;
876
876
Lines 887-890 subtest 'messages() and add_message() tests' => sub { Link Here
887
    is( ref($messages[1]), 'Koha::Object::Message', 'Right type returned' );
887
    is( ref($messages[1]), 'Koha::Object::Message', 'Right type returned' );
888
    is( $messages[0]->message, 'message_1', 'Right message recorded' );
888
    is( $messages[0]->message, 'message_1', 'Right message recorded' );
889
    is( $messages[1]->message, 'message_2', 'Right message recorded' );
889
    is( $messages[1]->message, 'message_2', 'Right message recorded' );
890
891
    $patron->reset_messages;
892
    @messages = @{ $patron->messages };
893
    is( scalar @messages, 0, 'No messages are returned' );
894
895
    $patron->reset_messages;
896
    @messages = @{ $patron->messages };
897
    is( scalar @messages, 0, 'No messages are returned, things ok when calling on already empty list' );
890
};
898
};
891
- 

Return to bug 26555