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 |
- |
|
|