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

(-)a/Koha/Object.pm (+4 lines)
Lines 345-350 Returns the (probably non-fatal) messages that were recorded on the object. Link Here
345
345
346
sub messages {
346
sub messages {
347
    my ( $self ) = @_;
347
    my ( $self ) = @_;
348
349
    $self->{_messages} = []
350
        unless defined $self->{_messages};
351
348
    return $self->{_messages};
352
    return $self->{_messages};
349
}
353
}
350
354
(-)a/t/db_dependent/Koha/Object.t (-2 / +12 lines)
Lines 870-876 subtest 'set_or_blank' => sub { Link Here
870
870
871
subtest 'messages(), add_message() and reset_messages() tests' => sub {
871
subtest 'messages(), add_message() and reset_messages() tests' => sub {
872
872
873
    plan tests => 8;
873
    plan tests => 10;
874
875
    $schema->storage->txn_begin;
874
876
875
    my $patron = Koha::Patron->new;
877
    my $patron = Koha::Patron->new;
876
878
Lines 895-898 subtest 'messages(), add_message() and reset_messages() tests' => sub { Link Here
895
    $patron->reset_messages;
897
    $patron->reset_messages;
896
    @messages = @{ $patron->messages };
898
    @messages = @{ $patron->messages };
897
    is( scalar @messages, 0, 'No messages are returned, things ok when calling on already empty list' );
899
    is( scalar @messages, 0, 'No messages are returned, things ok when calling on already empty list' );
900
901
    my $patron_id = $builder->build_object({ class => 'Koha::Patrons' })->id;
902
    # get a patron from the DB, ->new is not called, ->messages should initialize _messages as an empty arrayref
903
    $patron = Koha::Patrons->find( $patron_id );
904
905
    isnt( $patron->messages, undef, '->messages initializes the array if required' );
906
    is( scalar @{ $patron->messages }, 0, '->messages returns an empty arrayref' );
907
908
    $schema->storage->txn_rollback;
898
};
909
};
899
- 

Return to bug 26555